PyLU
Small nogil-compatible Cython-based solver for linear equation systems A x = b.
We use semantic versioning.
For my stance on AI contributions, see the collaboration guidelines.
Introduction
The algorithm is LU decomposition with partial pivoting (row swaps). The code requires only NumPy and Cython.
The main use case for PyLU (over numpy.linalg.solve) is solving many small systems inside a nogil block in Cython code, without requiring SciPy (for its cython_lapack module).
Python and Cython interfaces are provided. The API is designed to be as simple to use as possible.
The arrays are stored using the C memory layout.
A rudimentary banded solver is also provided, based on detecting the band structure (if any) from the initial full LU decomposition. For cases where L and U have small bandwidth, this makes the O(n**2) solve step run faster. The LU decomposition still costs O(n**3), so this is useful only if the system is small, and the same matrix is needed for a large number of different RHS vectors. (This can be the case e.g. in integration of ODE systems with a constant-in-time mass matrix.)
Examples
Basic usage:
import numpy as np
import pylu
A = np.random.random( (5,5) )
b = np.random.random( 5 )
x = pylu.solve( A, b )
For a complete tour, see the test suite.
The main item of interest, however, is the Cython API in dgesv.pxd. The main differences to the Python API are:
- Function names end with
_c. - Explicit sizes must be provided, since the arrays are accessed via raw pointers.
- The result array
xmust be allocated by the caller, and passed in as an argument. Seedgesv.pyxfor examples on how to do this in NumPy.
Installation
From PyPI
pip install pylu
From source
git clone https://github.com/Technologicat/pylu.git
cd pylu
pip install .
For maximum performance on your machine, build with architecture-specific optimizations:
CFLAGS="-march=native" pip install --no-build-isolation .
Pre-built wheels from PyPI use generic -O2 because -march=native bakes in the instruction set of the build machine — a wheel built with AVX-512 would crash on a CPU without it. Building from source avoids this and lets the compiler target your specific hardware.
Development setup
PyLU uses meson-python as its build backend and PDM for dependency management.
git clone https://github.com/Technologicat/pylu.git
cd pylu
pdm install # creates venv, installs dev deps
pip install --no-build-isolation -e . # editable install (needs venv activated)
The --no-build-isolation flag is required for editable installs with meson-python — the on-import rebuild mechanism needs build dependencies (Cython, NumPy, meson, ninja) to remain available in the environment, not just in a throwaway build-time overlay.
PATH note: The meson-python editable loader needs meson and ninja on PATH. If you get rebuild errors, ensure the venv's bin/ is on the path:
export PATH="$(pwd)/.venv/bin:$PATH"
Note on editable installs: After modifying .pyx or .pxd files, the next import auto-rebuilds the Cython extension — no manual reinstall step needed. For a clean non-editable build, use pip install . and reinstall after changes.
Dependencies
Requires Python ≥ 3.11.
License
BSD. Copyright 2016–2026 Juha Jeronen, University of Jyväskylä, and JAMK University of Applied Sciences.
Acknowledgement
This work was financially supported by the Jenny and Antti Wihuri Foundation.
Metadata
Release files for pylu 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pylu-1.1.0.tar.gz | 40.2 kB | With provenance | Details |
Built distributions (wheels)
Total release size: 1.6 MB
Release files / pylu-1.1.0.tar.gz
| Download URL | pylu-1.1.0.tar.gz |
|---|---|
| Size | 40.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb4ea5bb4d874ebceb62023e5a62eb76e2ff26bf4bf821582ce33d0054cf19f1
|
|
BLAKE2b-256 checksum How to use checksums |
b23fb6330bcc679a4367f645597bce93a197690dc54d5a938f691f135aef8f4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp315-cp315-win_amd64.whl
| Download URL | pylu-1.1.0-cp315-cp315-win_amd64.whl |
|---|---|
| Size | 92.3 kB |
| Tags | CPython 3.15 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
dee88255c7d35648015c6a9e67dc35672033c73259d675dd7824987edf886727
|
|
BLAKE2b-256 checksum How to use checksums |
87a9246bea39244d797510b89d7a6befe2df4c997f7330e94a445893d32db91b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylu-1.1.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 122.6 kB |
| Tags | CPython 3.15 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
cc1a124a01b113fb3f7d6716fe1341c623b451b3ab744bda3067241f4c718d7e
|
|
BLAKE2b-256 checksum How to use checksums |
13537aeeaa662e654f009efb583cf0bd775002cb036f06f277b34da61c70c759
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp315-cp315-macosx_11_0_arm64.whl
| Download URL | pylu-1.1.0-cp315-cp315-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.8 kB |
| Tags | CPython 3.15 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dfd7cf6e8f269065e948e85de1c958c3668c819f2c6c5da2076f8039c05cbf76
|
|
BLAKE2b-256 checksum How to use checksums |
b5e3a936fcbdfa479bd67361414f63a39e7e516da2d6249024de9815085eeb0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp314-cp314-win_amd64.whl
| Download URL | pylu-1.1.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 92.8 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b695bd4b34bb1a755f67d32d11f810f0c4266c19f0291e51640fbb20d6334394
|
|
BLAKE2b-256 checksum How to use checksums |
ce668e7d7ff0f7cf68941cb6e64b357e8c9b53cf42b4c864312ca44e370b2757
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylu-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 122.6 kB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ca0bca5ff05294e0e36dcab9c47e55fbdd04ecd1b907d6efecc0ba87a213a84c
|
|
BLAKE2b-256 checksum How to use checksums |
6b7b2bac4771c7560c9118f2f33f398fc9b29ae8451e47cffa284b9b961bbffb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | pylu-1.1.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.8 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
50027f1d4245282d07a302df5e99f9362223a06d6062321f5877f4777307746b
|
|
BLAKE2b-256 checksum How to use checksums |
d7968e4ad409a46a49af2679c34196d141022c75fd1bee98f92faedc918587a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp313-cp313-win_amd64.whl
| Download URL | pylu-1.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 90.1 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8c1600c4caca38123ee11c0f94f31e7e15a2a63531c79ed80f09b497b7cb8c23
|
|
BLAKE2b-256 checksum How to use checksums |
4a8b3acb7b0b9cbab95e18b9dd3ffdaf27c6a35cc5c1575aed6e6b7e3288e41b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylu-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 122.4 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e54d53f6e01ffcebb7d1042503177433b6445a238438e5ba915e6bec1438ad11
|
|
BLAKE2b-256 checksum How to use checksums |
afb0988c73634aeb3b57ff28e6fbc6abb6a595b440f1f9ab6737a3f87adfe2a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | pylu-1.1.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.2 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6b6dcdef8e274cb7586dc180bbc5d8357bca6836e973aa55602003b396b1ff93
|
|
BLAKE2b-256 checksum How to use checksums |
759797c16c72b4e26229f1577b130c14f20803c7bb8c64a37f2a21055de761a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp312-cp312-win_amd64.whl
| Download URL | pylu-1.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 90.1 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a0a88332b23fa0781febe58e6f5533652e765d9df830a511a6ef0b1763195eaf
|
|
BLAKE2b-256 checksum How to use checksums |
fa267b88cb63a4f3c8c7e6a5e60a5048f0711f4c072edeedadfca14a2e446dab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylu-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 122.6 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0d2066b1cb20533fc8740b73df0fdcf1a9d6d26a6bbcc1237210d66fb22fcb70
|
|
BLAKE2b-256 checksum How to use checksums |
05f1be55d3f56edef23b7065edf0f3103af08e87f9025864dabded907aeb94fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pylu-1.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 92.9 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
151f1f5eb5396cfe1ce7ffdb32ebba9c17a259886998cd24fd242d263b49494c
|
|
BLAKE2b-256 checksum How to use checksums |
1ed54bd15432a681770a6b9c80b0ec78b5eb8825a2fe4f77aea25d7e9b7d7ed2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp311-cp311-win_amd64.whl
| Download URL | pylu-1.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 90.9 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a3e5f2e02ed5116afab3ab602a71200422d37f80dad2d6c81447c0f70628cabd
|
|
BLAKE2b-256 checksum How to use checksums |
1d5d3985f348665901d54c1eb90e3e42a7b3d619a987afd5434b6bcec303d9b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylu-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 126.5 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
fd3ba23cd2894dbc3c3b603cf939173cb950f7cc59362ccfc041e8515c6d24bc
|
|
BLAKE2b-256 checksum How to use checksums |
00860664ba8c2342f5229373d21b66c117f9f0f0d5588c9c06e3da49f017b1ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / pylu-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pylu-1.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 91.9 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
674896f527226f61318a714fddd291028299bddaded9346a40944d43dab1db1c
|
|
BLAKE2b-256 checksum How to use checksums |
5751784bea2638c6a14df21a6d44ea502f4af9538f291a8781dacc8f099a9613
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logSecurity for pylu 1.1.0
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.
Full provenance
All 16 files in this release have been uploaded with provenance metadata.
Attestation for pylu-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logA 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.