Metadata-Version: 2.4
Name: nbklu
Version: 0.2.0
Summary: Python wrapper for KLU
Author-Email: Azuk 443 <me@azuk.top>
License-Expression: BSD-3-Clause
License-File: LICENSE
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Project-URL: Homepage, https://github.com/determ1ne/nbklu
Project-URL: Issues, https://github.com/determ1ne/nbklu/issues
Requires-Python: >=3.10
Requires-Dist: numpy>=2.0.0
Description-Content-Type: text/markdown

# nbklu: Python bindings for KLU in nanobind

## Installation

```
pip install nbklu
# or install from source
pip install git+https://github.com/determ1ne/nbklu.git
```

## Usage

```python
import numpy as np
from nbklu import KLUSolver


def main():
    n = 5
    Ap = np.array([0, 2, 5, 9, 10, 12])
    Ai = np.array([0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4])
    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])
    b = np.array([8.0, 45.0, -3.0, 3.0, 19.0])
    B = np.stack([b, b * 2, b * 3, b * 4], axis=0)

    solver = KLUSolver()
    solver.analyze(n, Ap, Ai)
    solver.factor(Ax)
    X = solver.solve(B)

    print(X)


if __name__ == "__main__":
    main()
```

Detailed documentation can be found in the [KLU documentation](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/KLU/Doc/KLU_UserGuide.pdf).
