Skip to main content

Python wrapper for KLU

Project description

nbklu: Python bindings for SuiteSparse KLU

nbklu provides:

  • Full low-level bindings for the public klu.h API families
    • 32-bit index real (klu_*)
    • 32-bit index complex (klu_z_*)
    • 64-bit index real (klu_l_*)
    • 64-bit index complex (klu_zl_*)
  • A high-level solver API with typed variants.

Installation

pip install nbklu
# optional SciPy integration
pip install "nbklu[scipy]"
# or from source
pip install git+https://github.com/determ1ne/nbklu.git

Solver usage

import numpy as np
from nbklu import KLUSolver

n = 5
Ap = np.array([0, 2, 5, 9, 10, 12], dtype=np.int32)
Ai = np.array([0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4], dtype=np.int32)
Ax = np.array([2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0], dtype=np.float64)
b = np.array([8.0, 45.0, -3.0, 3.0, 19.0], dtype=np.float64)

solver = KLUSolver(index_bits=32, complex_values=False)
solver.analyze(n, Ap, Ai)
solver.factor(Ax)
x = solver.solve(b)
print(x)

Typed solver variants

  • KLUSolver32Real
  • KLUSolver32Complex
  • KLUSolver64Real
  • KLUSolver64Complex

All variants support:

  • analyze / analyze_given
  • factor / refactor
  • solve / tsolve
  • sort, flops, rgrowth, condest, rcond, scale, extract

Low-level API

Import nbklu._ext for direct C-parity functions (analyze, z_factor, l_solve, zl_extract, version, ...). Complex APIs accept both:

  • interleaved float64 arrays (KLU layout)
  • numpy.complex128 arrays.

Notes

SciPy API (nbklu.scipy)

SciPy integration interface mirrors scipy.sparse.linalg patterns:

import numpy as np
from scipy.sparse import csc_matrix
from nbklu.scipy import spsolve, factorized, splu

A = csc_matrix(...)
b = np.array(...)

x = spsolve(A, b)

solve = factorized(A)
x2 = solve(b)

lu = splu(A)
x3 = lu.solve(b)
x4 = lu.solve(b, trans="T")

This module accepts SciPy sparse matrices/arrays and internally dispatches to the appropriate KLU family.

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

nbklu-0.3.0.tar.gz (213.3 kB view details)

Uploaded Source

Built Distributions

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

nbklu-0.3.0-cp314-cp314t-win_amd64.whl (236.1 kB view details)

Uploaded CPython 3.14tWindows x86-64

nbklu-0.3.0-cp314-cp314t-win32.whl (199.8 kB view details)

Uploaded CPython 3.14tWindows x86

nbklu-0.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl (341.0 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

nbklu-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (242.4 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

nbklu-0.3.0-cp312-abi3-win_amd64.whl (223.9 kB view details)

Uploaded CPython 3.12+Windows x86-64

nbklu-0.3.0-cp312-abi3-win32.whl (191.1 kB view details)

Uploaded CPython 3.12+Windows x86

nbklu-0.3.0-cp312-abi3-musllinux_1_2_x86_64.whl (334.9 kB view details)

Uploaded CPython 3.12+musllinux: musl 1.2+ x86-64

nbklu-0.3.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (236.4 kB view details)

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

nbklu-0.3.0-cp311-cp311-win_amd64.whl (225.9 kB view details)

Uploaded CPython 3.11Windows x86-64

nbklu-0.3.0-cp311-cp311-win32.whl (193.0 kB view details)

Uploaded CPython 3.11Windows x86

nbklu-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl (339.6 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

nbklu-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (241.0 kB view details)

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

nbklu-0.3.0-cp310-cp310-win_amd64.whl (226.5 kB view details)

Uploaded CPython 3.10Windows x86-64

nbklu-0.3.0-cp310-cp310-win32.whl (193.1 kB view details)

Uploaded CPython 3.10Windows x86

nbklu-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl (339.8 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

nbklu-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (241.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file nbklu-0.3.0.tar.gz.

File metadata

  • Download URL: nbklu-0.3.0.tar.gz
  • Upload date:
  • Size: 213.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e11413f81f635ce768496ae5c0840d330a26eb93591c26e90eb1c60768fb7787
MD5 b3b2efcc67773792647c000611e91d39
BLAKE2b-256 54f4311a2c4eb7defc5dd23f187b676e4fb5390279ef11c97ac53b46ae4c5e9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0.tar.gz:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 236.1 kB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 b16a55487bb8d584a2cd24ccd156f638086636a2b51a333ac81e7f6cd373b0f9
MD5 2f55c756a6049abba7373278f0251830
BLAKE2b-256 007562422f357434d7f9afae0fac8773e623737d08afbeb014ed09312e73c07e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp314-cp314t-win_amd64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp314-cp314t-win32.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp314-cp314t-win32.whl
  • Upload date:
  • Size: 199.8 kB
  • Tags: CPython 3.14t, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 c1855cc71e1dca48b18fde7e73b610f743f8b35a3e3e1c6b78b472c118cc326e
MD5 1d385d3cbf0d040c01b7d6fd23815c26
BLAKE2b-256 582cc00bacac83c4c981759cdae11ba8084d3a813e9c1e36c8ed91083e8dbd40

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp314-cp314t-win32.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 50a09f752b1fa3c73f2f4e31d2c5eff9fc35712716c81123d8f2880c8177fa12
MD5 4b8282ddd08482daaf2c480b9774dd1e
BLAKE2b-256 d3af120ce807465382615df51bf1110c0e542e34738204aaa57a2ec724181f3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f54e8c6830f65a54e634f21954d2374a6333007ec8af95a9f84efd8be0620223
MD5 fe922533b2ad5fc84a3091a3294d2bb2
BLAKE2b-256 600d2d7b635f5c3a091a932772e6c9e8adfe6facd8594fc41aecd1f41cd79826

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 223.9 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 59bcc6751d8793142f72123552bbfc8d330a9117f66b56ecc648995d2c7d5577
MD5 c0c1b35d5f1ada18894e768c0ee140b6
BLAKE2b-256 2ca667ead01abb33bf7b625804b71ae4b314a8ee7102f4dc50d9bfb50fb023fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp312-abi3-win_amd64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp312-abi3-win32.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp312-abi3-win32.whl
  • Upload date:
  • Size: 191.1 kB
  • Tags: CPython 3.12+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp312-abi3-win32.whl
Algorithm Hash digest
SHA256 6a2875c07742573d9aa0b8ba51fd71ae98088f71527a6c4353ffd2aa7398ca38
MD5 0cc24d133cc782f5f80de669f5d141a4
BLAKE2b-256 cadc49c40b201f50ca400737f32c2c055207bd7bbbaf7f8676d8ea692ef10ab8

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp312-abi3-win32.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp312-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f540a684818c763cbef0b734e00ad426ab39916be47bd38042b7a4e992c3f0d7
MD5 581b5aaa3a7eb97c0883aea1c09ff71a
BLAKE2b-256 ec8cf36217fb46c6132ca55a450471d4feee3323178388a68e9c436fdd0f8d26

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp312-abi3-musllinux_1_2_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6ee5aec9164b9e5886119e00364b90d997ea1ec945f3ccf647661e57e8353575
MD5 67db9be42bcb0069d0ab3a0f06e7aa1c
BLAKE2b-256 af93e39a133f4b56bb9206c8a7aab23961206d69d54271bd6568edc73ff88da0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 225.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1f7c177bd059633aa67dec7fd31e080e80e56829768c7e6bbdb887a5bbbaf1a4
MD5 b406c9cd9d635c30fc64101bbc9ce47c
BLAKE2b-256 9f24b12fdb0f7f96293412b9200a99f2e20d85264295f4fd1e5f268fd8c7b6aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp311-cp311-win_amd64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp311-cp311-win32.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 193.0 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 57fabc1b03aa34c41cc2381cc426863fa2d90b83d054dc55880821266841de7d
MD5 974f4e980b5817048d842253cc44871e
BLAKE2b-256 e8620ef6ad51de33417ec475c329f359b8377923232b6296d0a50afe649c2304

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp311-cp311-win32.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0de8d1746388d5273613933d67c783141fe23d7723f9dabad04216cc07bd05e2
MD5 69bfd86d2d03bca37d9c0923ae380374
BLAKE2b-256 3d8d4196ba229715616d7ae8a76ddeee99df29f94380cdf9c6b13b06b528ecae

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4c9584a7a3cceda92413cf433d394fe7968d6203c8d4c96ed3f68c389a9dad6
MD5 fc9400b5c99f6084c0ffb04ffdc3edff
BLAKE2b-256 028d4e7c628d198226336f711ea197f50a941ca97fae2962a9e1e1bc1b3a4adb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 226.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2d7460fdbf2eb92c13ad09bb6f23cd8db512e5186e9dfdfaf3aa572527b06deb
MD5 d1790a308fd9f9d1d8bdaaf9f55dbfc2
BLAKE2b-256 083a8f9e846fb46011c3d3e495908d1f8843d10fb24991041f886c2047a0bceb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp310-cp310-win_amd64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp310-cp310-win32.whl.

File metadata

  • Download URL: nbklu-0.3.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 193.1 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nbklu-0.3.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 24d7407a3aacb9ee50e8259e1775c11ac2a04a404fd6fab2d6517f1a4005a4e4
MD5 3bb97f2cf909aef7ba622fdec7bc34c0
BLAKE2b-256 4c89562fd2ff8d06641d976d879dea3b51dd4bdcb340f5b11c89fd28b444f808

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp310-cp310-win32.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 105fd4c9f1e18cd1b4382f0320c402484d29dcc20fa26d850ff01474176df3ae
MD5 df8ae7fbe1578bb7ceccfcf444fc6146
BLAKE2b-256 949e08095949b9acbcb8122501c855e0a62c3ea8604288c5079fac4226d0d076

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

File details

Details for the file nbklu-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nbklu-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3dfff386371328b884d05b0a3e869744788887950d427949ba5a84cafb3150fa
MD5 e9ed8184c86cc3144e6fadb8b5f2a2b0
BLAKE2b-256 f9e27735c3e00fde0dbae4df3d37c68bae0078deae6db8c1db2f31a7562daf42

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbklu-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build_wheels.yml on determ1ne/nbklu

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

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