NULAPACK is a lightweight, high-performance numerical linear algebra library. It provides a set of core subroutines implemented in Fortran for efficiency, with convenient C++ and Python interfaces.
nulapack can be installed from PyPI or built from source.
Using uv is recommended for fast and reproducible environments.
Using pip
System-wide (user install):
pip install --upgrade --user nulapackYou may need to use pip3 instead of pip depending on your Python installation.
Inside a virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install --upgrade nulapackUsing uv (recommended)
Install into a new environment:
uv venv
source .venv/bin/activate
uv pip install nulapackAdd to an existing uv project:
uv add nulapack
uv syncUsing pipenv
pipenv install nulapackUsing poetry
poetry add nulapackUsing hatch
hatch add nulapackpyproject.toml:
[project.dependencies]
nulapack = ">=0.1.0"requirements.txt:
nulapack>=0.1.0
Building from source is useful if you want the latest features or need to modify the Fortran core.
Prerequisites
- CMake ≥ 3.10
- Fortran compiler (e.g.
gfortran) - C/C++ compiler (e.g.
gcc,clang) - Python ≥ 3.9
- uv
Build and install
git clone https://github.com/eggzec/NULAPACK.git
cd NULAPACK
uv venv
source .venv/bin/activate
uv run bin/build.py develop --with-pyPython
import numpy as np
from nulapack import doolittle
A = np.array([[4, 3], [6, 3]], dtype=np.float64)
L, U, info = doolittle(A)
if info == 0:
print("L:\n", L)
print("U:\n", U)C++
#include <iostream>
#include <vector>
#include "Doolittle.h"
int main() {
int n = 2;
std::vector<double> a = {4, 3, 6, 3};
std::vector<double> l(n * n, 0.0);
std::vector<double> u(n * n, 0.0);
int info;
doolittle(&n, a.data(), l.data(), u.data(), &info);
if (info == 0) {
// Use l and u
}
return 0;
}