Sparse symmetric indefinite direct solver with certified inertia, in pure Rust.
Project description
feral-solver
Python bindings for feral, a pure-Rust sparse symmetric indefinite direct solver with certified inertia counts. Aimed at interior-point methods (the IPM in discopt is the primary consumer), but usable for any application that factors symmetric KKT-shaped systems.
Install
pip install feral-solver # plain
pip install 'feral-solver[scipy]' # with scipy.sparse adapters
uv add feral-solver # via uv
Wheels are published for CPython 3.10+ on Linux x86_64/aarch64, macOS universal2, and Windows x86_64. abi3 means one wheel per platform/arch covers all supported Python minor versions.
Quickstart
import numpy as np
import feral
A = feral.CscMatrix.from_dense(np.array([
[4.0, 1.0, 0.0],
[1.0, 3.0, 2.0],
[0.0, 2.0, 5.0],
]))
solver = feral.Solver()
status, inertia = solver.factor(A)
assert status == feral.FactorStatus.SUCCESS
print(inertia) # Inertia(n_pos=3, n_neg=0, n_zero=0)
b = np.array([1.0, 2.0, 3.0])
x = solver.solve(b)
print(np.allclose(A.symv(x), b)) # True
IPM use
The feral.ipm.KktSolver class wraps Solver with the Wächter–Biegler
2006 §3.1 perturbation-escalation loop. Symbolic analysis is cached;
across an entire Newton run solver.symbolic_call_count stays at 1.
import feral
import feral.ipm
kkt_pattern = feral.CscMatrix.from_scipy(my_kkt) # see scipy adapter
kkt = feral.ipm.KktSolver(
kkt_pattern,
expected_inertia=feral.Inertia(n_vars, n_equality_constraints),
)
for newton_iter in range(max_iter):
report = kkt.factor(values_this_iter) # auto-perturbs if needed
if report.status != feral.FactorStatus.SUCCESS:
break
dx_aff, dx_corr = kkt.solve_pair(b_aff, b_corr)
...
See examples/discopt_ipm_kkt.py for an end-to-end Newton step
against a small NLP.
scipy.sparse interop
import scipy.sparse as sp
import feral
A_scipy = sp.csc_matrix(...)
A = feral.from_scipy(A_scipy, symmetric="full") # reads lower triangle
# ... factor, solve ...
A_back = feral.to_scipy(A) # round-trips to scipy
Building from source
Requires a stable Rust toolchain (1.75+) and Python 3.10+.
git clone https://github.com/jkitchin/feral.git
cd feral/python
pip install maturin
maturin develop --release # builds and installs into current venv
pytest tests/
License
MIT, same as the underlying Rust crate.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file feral_solver-0.4.0.tar.gz.
File metadata
- Download URL: feral_solver-0.4.0.tar.gz
- Upload date:
- Size: 552.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b7314b00d93c7988ae7ca001192c57aa599d773e2c7d035098e5990c09505c7
|
|
| MD5 |
3465274b74740ee80947af467c91ed1c
|
|
| BLAKE2b-256 |
1a7586fda56c14b3f0d1a20c7f04120211b7ef1ff0bac3a4210bd9281771b84a
|
Provenance
The following attestation bundles were made for feral_solver-0.4.0.tar.gz:
Publisher:
python-wheels.yml on jkitchin/feral
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
feral_solver-0.4.0.tar.gz -
Subject digest:
7b7314b00d93c7988ae7ca001192c57aa599d773e2c7d035098e5990c09505c7 - Sigstore transparency entry: 1564085059
- Sigstore integration time:
-
Permalink:
jkitchin/feral@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jkitchin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Trigger Event:
release
-
Statement type:
File details
Details for the file feral_solver-0.4.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: feral_solver-0.4.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 605.7 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d1c6520796e1cf61a11407d35400c4c320382e51e42e5c2ef0fe521daecf055
|
|
| MD5 |
bbe29dab87d42f8d35909eed813c0931
|
|
| BLAKE2b-256 |
6a94c5c6d52cc4aba4e04452340adaa2f465e1032e1cf95ff1fc3eeb0d173c25
|
Provenance
The following attestation bundles were made for feral_solver-0.4.0-cp310-abi3-win_amd64.whl:
Publisher:
python-wheels.yml on jkitchin/feral
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
feral_solver-0.4.0-cp310-abi3-win_amd64.whl -
Subject digest:
0d1c6520796e1cf61a11407d35400c4c320382e51e42e5c2ef0fe521daecf055 - Sigstore transparency entry: 1564085152
- Sigstore integration time:
-
Permalink:
jkitchin/feral@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jkitchin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Trigger Event:
release
-
Statement type:
File details
Details for the file feral_solver-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: feral_solver-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 640.9 kB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e02fb89b1c8751ec754b44a22b710c69a2ef692a39156b0391ddd6bb0126b69
|
|
| MD5 |
0aede5ffa41ff57d76b430ae65c4fff7
|
|
| BLAKE2b-256 |
70f8a99f770163f389c77f15cf3d769e9124fc10b3022bcd01c043fa97c0e411
|
Provenance
The following attestation bundles were made for feral_solver-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl:
Publisher:
python-wheels.yml on jkitchin/feral
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
feral_solver-0.4.0-cp310-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
8e02fb89b1c8751ec754b44a22b710c69a2ef692a39156b0391ddd6bb0126b69 - Sigstore transparency entry: 1564085273
- Sigstore integration time:
-
Permalink:
jkitchin/feral@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jkitchin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Trigger Event:
release
-
Statement type:
File details
Details for the file feral_solver-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: feral_solver-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 715.3 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de387031ee1929017aaafe669f0639c65659f54cc76d74f44a87d784f1242d13
|
|
| MD5 |
582da99d74fdd33a0f68be021439970b
|
|
| BLAKE2b-256 |
f1c9d341725fd8a3eab4a5d90e34225a7f8ddfdac496400a991ffc15823a9299
|
Provenance
The following attestation bundles were made for feral_solver-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python-wheels.yml on jkitchin/feral
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
feral_solver-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
de387031ee1929017aaafe669f0639c65659f54cc76d74f44a87d784f1242d13 - Sigstore transparency entry: 1564085205
- Sigstore integration time:
-
Permalink:
jkitchin/feral@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jkitchin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Trigger Event:
release
-
Statement type:
File details
Details for the file feral_solver-0.4.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: feral_solver-0.4.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5edfabb69cadfd668ed7cad327e2f9c2d7d7d9db109ea039d1a2c99f773130a2
|
|
| MD5 |
d44ee0724a9159bcae8726041f23aaa9
|
|
| BLAKE2b-256 |
49786262aa879d6f586047bc332c2cf95d93d86313d9c385fd1728b8c25c46d3
|
Provenance
The following attestation bundles were made for feral_solver-0.4.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:
Publisher:
python-wheels.yml on jkitchin/feral
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
feral_solver-0.4.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl -
Subject digest:
5edfabb69cadfd668ed7cad327e2f9c2d7d7d9db109ea039d1a2c99f773130a2 - Sigstore transparency entry: 1564085116
- Sigstore integration time:
-
Permalink:
jkitchin/feral@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jkitchin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-wheels.yml@2442d1fb60e3cb26fa448aebf073d9b1204b2934 -
Trigger Event:
release
-
Statement type: