Skip to main content

python-la

Python library for linear algebra with a course-shaped API: vectors, matrices, fields, spans, linear maps, polynomials, and inner-product spaces.

PyPI Python License: MIT

Names and operations follow typical first-course linear algebra (kernel, characteristic_polynomial, to_orthonormal, …). It is aimed at readable math-facing code, not high-performance numeric workloads (use NumPy/SciPy for that).

Install

pip install python-la

Requires Python 3.11+. Runtime dependency: danielutils.

Usage

from python_la import Matrix, Span, Vector, PolynomialSimple, LinearMap, RealField, VectorSpace

Matrix([[1, 2], [3, 4]]).gaussian_elimination()
# row-reduced form (identity for this matrix)

Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]).characteristic_polynomial
# X^3 - 15X^2 - 18X

Matrix([[1, 0, 1], [0, 1, 1]]).kernel
# span basis vector [-1, -1, 1]

v1, v2 = Vector([3, 4]), Vector([4, 5])
Span([v1, v2]).to_orthonormal()

R2 = RealField(2)
V = VectorSpace(R2)
lm = LinearMap(V, V, lambda vector: Vector([0, vector[0]], R2))
x_squared = PolynomialSimple.from_string("x^2")
plus_1 = PolynomialSimple.from_string("x+1")
P = plus_1(x_squared)  # X^2 + 1
v = V.random()
P(lm)(v) == v

Main types: Matrix, Vector, Span, LinearMap, VectorSpace, field types (RealField, and complex/rational variants), polynomials, and (in la2) bilinear forms / inner-product spaces.

Package layout

Module Contents
python_la.la1 Fields, vectors, matrices, spans, linear maps, vector spaces
python_la.la2 Polynomials / expressions, bilinear forms, inner products
python_la.utils Internal helpers
python_la.other Extras (Graph, Permutation)

Class-level notes next to the code: python_la/la1/README.md.

Development

Contributor workflow (layout, tests, PR labels): AGENTS.md.

Report security issues privately via GitHub advisories.

License

MIT — see LICENSE.

Metadata

Release files for python-la 0.97.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for python-la 0.97.1
File Interpreter ABI Platform Actions
python_la-0.97.1-py3-none-any.whl Python 3 none any Details for python_la-0.97.1-py3-none-any.whl

Release files / python_la-0.97.1-py3-none-any.whl

Download URL python_la-0.97.1-py3-none-any.whl
Size 48.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b5c15519ae0467cf4e9262fb4a2151d730445009aafa5ae96a7663e5fccb1b9
BLAKE2b-256 checksum
How to use checksums
01acdb79fc9f5ffc1d3e225af50b90c2497cf1b4064215ae10561dc03f8204c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for python-la 0.97.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page