Skip to main content

linear algebra in your console

Project description

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.

Status: sections [0]–[4] of the 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. 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:

# 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'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.

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.

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.


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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linacon-0.1.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linacon-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file linacon-0.1.0.tar.gz.

File metadata

  • Download URL: linacon-0.1.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for linacon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 731beae424e45ae1cf0aa6885061c5445e361142f87235c888c9f2d5c4260181
MD5 066dbfbb8dd8327bbeb09fff72811dd6
BLAKE2b-256 28a8e29615e00e05a6364687f494efdca2f5d54d8e001e50cd25d12043b5f2dc

See more details on using hashes here.

File details

Details for the file linacon-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: linacon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for linacon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2b7f147e87f6874468419258b45b0140588ed9bd657d18326b515f411114b1e
MD5 3cbe0baf1c62ffad8eb93f094af5d0a8
BLAKE2b-256 a43659e583d59bec12c2dae5842d98bc9ef3d2cd2cacdc9f556de5887cb6c5fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page