Metadata-Version: 2.4
Name: linacon
Version: 0.1.0
Summary: linear algebra in your console
Project-URL: Homepage, https://github.com/cecinuga/lacli
Project-URL: Issues, https://github.com/cecinuga/lacli/issues
Author-email: cecinuga <matteo.marchetti.info@gmail.com>
License: MIT
License-File: LICENSE
Requires-Python: >=3.14
Requires-Dist: numpy>=2.4.6
Requires-Dist: pyarrow>=24.0.0
Description-Content-Type: text/markdown

# linacon

Linear algebra in your Console — yayo!

linacon runs in your terminal and provides a set of linear algebra commands.
All operations are performed using [NumPy](https://github.com/numpy/numpy). 

**Status:** sections [0]–[4] of the [Feature](#feature) roadmap are implemented and reachable from the CLI — basic matrix operations, property checks, rotations, factorizations and least squares, all backed by NumPy in [`src/linacon/core`](src/linacon/core). I/O beyond headerless CSV (section [5]) is still a roadmap.

### Usage

Requires Python >= 3.14, NumPy and PyArrow.

Every feature is reached as `<command> <feature>`, loading its matrices from CSV files:

```sh
# multiply two matrices
python -m linacon.main bmo matmul -f A.csv -g B.csv

# LU decomposition, written to CSV
python -m linacon.main factorization lu -f A.csv -out lu.csv

# ridge least squares (lambda via -k)
python -m linacon.main least-squares regularized -f A.csv -g b.csv -k 1.0
```

Use `python -m linacon.main <command> <feature> --help` to list a feature's flags.

---

### Technology Stack Problem
Pure Python is too slow, approximatelly 3sec for cicle 10000 numbers, inaceptable counting the opening of the file in memory

### I/O
You can set stdin and stdout to use files, pipes, or both in powerful combinations.

### Loading Pipeline

The loader delegates parsing to [PyArrow](https://arrow.apache.org/)'s `pyarrow.csv.read_csv`, configured for headerless numeric CSV: autogenerated column names, internal multi-threaded parsing, and no quoting/escaping for speed. The resulting Arrow table columns are stacked with `np.column_stack` into the final 2D NumPy array. See [`run`](src/linacon/main.py).

### Argument Parser

The parser is split by command (`bmo`, `checks`, `rotation`, `factorization`, `least-squares`), and each command exposes one sub-command per feature — every feature is reached through a command, never by direct access. Shared flags come from parent parsers: `-f/--file` (primary matrix), `-g/--file2` (second operand), `-k/--scalar`, `-b` (start-to-end benchmark) and `-out/--out` (CSV output path). See [`get_argparse`](src/linacon/arg.py).

### Output

When `-out` is given, the operation's result is written back as headerless CSV via PyArrow (loader-compatible). Multi-part results (e.g. `P`/`L`/`U` from a factorization, or the transform and transformed points from a rotation) are written one file per component as `<stem>.<name><suffix>`. See [`write_csv`](src/linacon/writer.py).

---

## Feature

### [0] Basic Matrix Operations
- [0.1] matrix mul (arbitrary dimensions)
- [0.2] matrix sum
- [0.3] matrix scalar mul
- [0.4] scalar dot product
- [0.5] scalar sum
- [0.6] inverse compute
- [0.7] transpose compute
- [0.8] rank compute

### [1] Checks
- [1.1] invertability check
- [1.2] vectors independence check
- [1.3] vectors orthogonality check
- [1.4] symmetric check
- [1.5] triangular check
- [1.6] positive definite check

### [2] Rotations
- [2.1] rotation matrix computation (input: matrix, angle, [axis], [center], [scale], [shear], [perspective])

### [3] Factorization
- [3.1] gauss-jordan elimination
- [3.2] LU decomposition
- [3.3] LDU decomposition
- [3.4] QR decomposition
- [3.5] Cholesky decomposition
- [3.6] orthogonal decomposition
- [3.7] SVD
- [3.8] eigenvalue decomposition

### [4] Least Squares 
- [4.1] least squares
- [4.2] weighted least squares
- [4.3] least squares with regularization
- [4.4] regularization
- [4.5] linear regression
