Skip to main content

PyLU

top language supported Python versions supported implementations CI status

version on PyPI PyPI package format dependency status

license open issues PRs welcome

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 x must be allocated by the caller, and passed in as an argument. See dgesv.pyx for 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.

Download files

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

Source Distribution

pylu-1.1.0.tar.gz (40.2 kB view details)

Uploaded Source

Built Distributions

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

pylu-1.1.0-cp315-cp315-win_amd64.whl (92.3 kB view details)

Uploaded CPython 3.15Windows x86-64

pylu-1.1.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (122.6 kB view details)

Uploaded CPython 3.15manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pylu-1.1.0-cp315-cp315-macosx_11_0_arm64.whl (92.8 kB view details)

Uploaded CPython 3.15macOS 11.0+ ARM64

pylu-1.1.0-cp314-cp314-win_amd64.whl (92.8 kB view details)

Uploaded CPython 3.14Windows x86-64

pylu-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (122.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pylu-1.1.0-cp314-cp314-macosx_11_0_arm64.whl (92.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pylu-1.1.0-cp313-cp313-win_amd64.whl (90.1 kB view details)

Uploaded CPython 3.13Windows x86-64

pylu-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (122.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pylu-1.1.0-cp313-cp313-macosx_11_0_arm64.whl (92.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pylu-1.1.0-cp312-cp312-win_amd64.whl (90.1 kB view details)

Uploaded CPython 3.12Windows x86-64

pylu-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (122.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pylu-1.1.0-cp312-cp312-macosx_11_0_arm64.whl (92.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pylu-1.1.0-cp311-cp311-win_amd64.whl (90.9 kB view details)

Uploaded CPython 3.11Windows x86-64

pylu-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (126.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pylu-1.1.0-cp311-cp311-macosx_11_0_arm64.whl (91.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file pylu-1.1.0.tar.gz.

File metadata

  • Download URL: pylu-1.1.0.tar.gz
  • Upload date:
  • Size: 40.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylu-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bb4ea5bb4d874ebceb62023e5a62eb76e2ff26bf4bf821582ce33d0054cf19f1
MD5 87dcc22246ec4132514a1157b34a6491
BLAKE2b-256 b23fb6330bcc679a4367f645597bce93a197690dc54d5a938f691f135aef8f4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0.tar.gz:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp315-cp315-win_amd64.whl.

File metadata

  • Download URL: pylu-1.1.0-cp315-cp315-win_amd64.whl
  • Upload date:
  • Size: 92.3 kB
  • Tags: CPython 3.15, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylu-1.1.0-cp315-cp315-win_amd64.whl
Algorithm Hash digest
SHA256 dee88255c7d35648015c6a9e67dc35672033c73259d675dd7824987edf886727
MD5 cfa684c32c11c9d89345f1cafc7c4417
BLAKE2b-256 87a9246bea39244d797510b89d7a6befe2df4c997f7330e94a445893d32db91b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp315-cp315-win_amd64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cc1a124a01b113fb3f7d6716fe1341c623b451b3ab744bda3067241f4c718d7e
MD5 11631f01332e7c1afc8ecf46e9274bc7
BLAKE2b-256 13537aeeaa662e654f009efb583cf0bd775002cb036f06f277b34da61c70c759

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp315-cp315-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp315-cp315-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfd7cf6e8f269065e948e85de1c958c3668c819f2c6c5da2076f8039c05cbf76
MD5 a708347858cfdb5fc65d426d6ad09ffd
BLAKE2b-256 b5e3a936fcbdfa479bd67361414f63a39e7e516da2d6249024de9815085eeb0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp315-cp315-macosx_11_0_arm64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: pylu-1.1.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 92.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylu-1.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 b695bd4b34bb1a755f67d32d11f810f0c4266c19f0291e51640fbb20d6334394
MD5 9505fb208abc9f43b5d802ce363b0c6a
BLAKE2b-256 ce668e7d7ff0f7cf68941cb6e64b357e8c9b53cf42b4c864312ca44e370b2757

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp314-cp314-win_amd64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ca0bca5ff05294e0e36dcab9c47e55fbdd04ecd1b907d6efecc0ba87a213a84c
MD5 c89d531afa904558b2f4d51d7d1cef87
BLAKE2b-256 6b7b2bac4771c7560c9118f2f33f398fc9b29ae8451e47cffa284b9b961bbffb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50027f1d4245282d07a302df5e99f9362223a06d6062321f5877f4777307746b
MD5 49a1d8bc5abba7c94e104f64ee3a6e0c
BLAKE2b-256 d7968e4ad409a46a49af2679c34196d141022c75fd1bee98f92faedc918587a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pylu-1.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 90.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylu-1.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8c1600c4caca38123ee11c0f94f31e7e15a2a63531c79ed80f09b497b7cb8c23
MD5 b93b88b97e54c651efceda81dae480f8
BLAKE2b-256 4a8b3acb7b0b9cbab95e18b9dd3ffdaf27c6a35cc5c1575aed6e6b7e3288e41b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp313-cp313-win_amd64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e54d53f6e01ffcebb7d1042503177433b6445a238438e5ba915e6bec1438ad11
MD5 4940fb6ddc112e87ce7e222000ff6918
BLAKE2b-256 afb0988c73634aeb3b57ff28e6fbc6abb6a595b440f1f9ab6737a3f87adfe2a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b6dcdef8e274cb7586dc180bbc5d8357bca6836e973aa55602003b396b1ff93
MD5 8d1aa101016d7d49ea029beff5d8db5c
BLAKE2b-256 759797c16c72b4e26229f1577b130c14f20803c7bb8c64a37f2a21055de761a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pylu-1.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 90.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylu-1.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a0a88332b23fa0781febe58e6f5533652e765d9df830a511a6ef0b1763195eaf
MD5 5e2b15e3745cbfee5ba6071ed654a9ce
BLAKE2b-256 fa267b88cb63a4f3c8c7e6a5e60a5048f0711f4c072edeedadfca14a2e446dab

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp312-cp312-win_amd64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0d2066b1cb20533fc8740b73df0fdcf1a9d6d26a6bbcc1237210d66fb22fcb70
MD5 d4d5b18c4b4e37b2a6a9758bbdd6ed13
BLAKE2b-256 05f1be55d3f56edef23b7065edf0f3103af08e87f9025864dabded907aeb94fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 151f1f5eb5396cfe1ce7ffdb32ebba9c17a259886998cd24fd242d263b49494c
MD5 137c304d81cfc0f4294c88a883119a8f
BLAKE2b-256 1ed54bd15432a681770a6b9c80b0ec78b5eb8825a2fe4f77aea25d7e9b7d7ed2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pylu-1.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 90.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pylu-1.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a3e5f2e02ed5116afab3ab602a71200422d37f80dad2d6c81447c0f70628cabd
MD5 5b1160460e873383c6babf0fcedb50ed
BLAKE2b-256 1d5d3985f348665901d54c1eb90e3e42a7b3d619a987afd5434b6bcec303d9b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp311-cp311-win_amd64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd3ba23cd2894dbc3c3b603cf939173cb950f7cc59362ccfc041e8515c6d24bc
MD5 cc4b3afa70ffe0bb3280b8c8a986c1f1
BLAKE2b-256 00860664ba8c2342f5229373d21b66c117f9f0f0d5588c9c06e3da49f017b1ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylu-1.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylu-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 674896f527226f61318a714fddd291028299bddaded9346a40944d43dab1db1c
MD5 209f1fed222abcddee70b618d7048ed8
BLAKE2b-256 5751784bea2638c6a14df21a6d44ea502f4af9538f291a8781dacc8f099a9613

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylu-1.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: ci.yml on Technologicat/pylu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.0 This release

16 files

1.0.1

13 files

1.0.0

13 files

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

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