star-linsolve 0.1.0
Small linear systems, correctly rounded
Public state: Released & Verified. The registry label is RELEASED. What the states mean →
Apache-2.0 Released & Verified single file
Summary
Determinant, solution and inverse of a square matrix of order 1 to 20 by elimination in exact rational arithmetic, each result rounded once: conditioning costs no digit and singularity is decided exactly; equal to SymPy's exact results on all 151 systems of the cross-check, Hilbert matrices of order 6 to 12 included.
Run in your browser
Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).
Runs in the browser: all 26 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026.
Use it on your computer
No account and no GitHub needed. Download, then install with one command:
- Install file · star_linsolve-0.1.0-py3-none-any.whl 3 kB
- Single file — copy it alongside your code · star_linsolve.py 4 kB
- Source code (.zip) 22 kB
python -m pip install star_linsolve-0.1.0-py3-none-any.whlIn Python: import star_linsolve
Cite it, and its bill of materials
For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.
@software{cavazzini_star_linsolve_0_1_0,
author = {Cavazzini, Andrea},
title = {{star-linsolve}: Small linear systems, correctly rounded},
version = {0.1.0},
year = {2026},
url = {https://andrea07072000.github.io/S.T.A.R.-/software/star_linsolve/},
note = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}
For developers
Install directly from the public repository:
python -m pip install "star-linsolve @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_linsolve"
Technical sheet
Requirements
- R1
det(a)returns the determinant,solve(a, b)the vector x with a x = b,inverse(a)the inverse, for a matrix given as a list or tuple of rows. - R2 The elimination is done in exact rational arithmetic on the floats given and each result is rounded once: the conditioning of the matrix costs no digit. A matrix is singular exactly when its exact determinant is zero; no tolerance is involved, so a nearly singular matrix is solved and an exactly singular one is refused.
- R3 Measured on 151 systems (110 well conditioned, 40 badly conditioned, and the Hilbert matrix of order 3 scaled to integers): determinant, solution and inverse equal the exact rational results of SymPy rounded to a float and those of mpmath at 400 digits. NumPy agrees within 1e-12 on the well-conditioned systems; on the badly conditioned ones it loses most digits or refuses the matrix as singular (the numbers are in the evidence file).
- R4 Every function returns floats or raises
ValueError: a matrix that is not square or larger than 20, entries that are not finite real numbers within 1e100 (booleans refused), a right-hand side of the wrong length, a singular matrix (forsolveandinverse), a result too large for a float.
Limits (what is not claimed)
Exact arithmetic on the floats you pass: 0.1 is not one tenth, and the solution of a badly conditioned system still changes a lot when the data change a little; the answer is exact for the matrix given, not for the one you meant. A determinant returned as 0.0 can be an underflow (two entries of 1e-200 on the diagonal) and is not by itself a proof of singularity: solve and inverse decide on the exact value. Not for large systems: nothing beyond order 20, no sparse matrices, no least squares, no eigenvalues, no condition number; a 20 x 20 inverse takes about a quarter of a second on a laptop and more when the entries have many different exponents.
Release gate
Computed by the registry from the result files, with the same function that decides RELEASED.
- Mutation score, latest measure of each module (needs at least 0.850)
- star_linsolve.py 0.879 (2026-10-07)
- Independent implementations written by others (needs 2)
- mpmath at 400 digits, numpy.linalg (LAPACK), SymPy exact rationals
- Result
- Released & Verified
Evidence in the registry
| Check | Status | Recorded | What was observed |
|---|---|---|---|
| Unit tests | VERIFIED | 2026-10-07 | 26 passed in 3.99s |
| Review | VERIFIED | 2026-10-07 | Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed |
| Review | VERIFIED | 2026-10-07 | Re-running the cross-check gives a byte-identical evidence file |
| Reference value | VERIFIED | 2026-10-07 | det(((60, 30, 20), (30, 20, 15), (20, 15, 12))) = 100.0; inverse = ((0.15, -0.6, 0.5), (-0.6, 3.2, -3.0), (0.5, -3.0, 3.0)) (suite: 26 passed in 3.99s) |
| Cross-check with independent libraries | VERIFIED | 2026-10-07 | star_linsolve returns the float nearest to the exact determinant, to each component of the solution and to each entry of the inverse of the matrix as given, for orders 1 to 20, whatever the conditioning |
| Benchmark | VERIFIED | 2026-10-07 | largest difference from the exact results: 0.0; numpy.linalg on Hilbert matrices of order 6 to 12 and nearly singular 2 x 2 matrices: up to 2.5e-01 relative |
| Clean install from the release tag | VERIFIED | 2026-10-07 | pytest outside the tree: 26 passed in 3.77s |
Fingerprints (SHA-256)
| star_linsolve-0.1.0-py3-none-any.whl | d25db3fe0969af8fb036cfd5b3f72b12d152a77123e9a842ad8e81a306c95100 |
| star_linsolve.py | d48a71831dd3ba433b1eced9bdf0f1dc07557a69a3140515c53404bd6f93ead3 |
| star_linsolve-0.1.0-source.zip | 9b23d6693ad6c8ef376e5d537ef2f60fba75ad240533088dba3fc7b0488f53e1 |
