Scarfs
A library to find an approximate fixed point for a bounded vector valued function.
Installation
pip install scarfs
Usage
Define the function you want to find a fixed point of using numba:
import numpy as np
from numba import njit
@njit
def roll(simp: np.ndarray) -> np.ndarray:
return np.roll(simp, 1)
For performance reasons, this function must be compiled by numba as a cfunc or
in nopython mode. A bare @njit is the simplest accepted form; if you annotate
an explicit signature, the argument must be a C-contiguous one-dimensional
float64 array (float64[::1]), while the return may have any layout — so
@jit(float64[::1](float64[::1])) works, but a map whose argument is typed as
non-contiguous (float64[:]) is rejected with a numba TypeError. Jitclass
functions are currently not supported. The function
must also lie in a bounded space, three default spaces are provided: the
simplex, the simplotope, and the unit hypercube. If your bounded space is not
one of these, you'll need to first compute a homeomorphism between your space
and one of these. The main algorithm runs on the simplex, so you may find it
faster if you can project there directly.
Once your function is defined, simply call one of the fixed point functions with an initial position and a discretization:
from scarfs import simplex_fixed_point
sol = simplex_fixed_point(roll, np.array([1, 0, 0, 0], float), 100)
The result is guaranteed to be within 1 / discretization of a true fixed
point (or a little larger for the other bounded spaces).
Note that fixed points are difficult to approximate generally, so this may run for a very long time.
The public entry points validate the discretization and initial point and raise
a descriptive ValueError on bad values, but the map itself is trusted: passing
one with an incompatible signature surfaces as an arcane numba TypeError.
Development
uv run ruff format --check
uv run ruff check
uv run pyright
uv run pytest
Publishing
Releases are cut from the release GitHub Actions workflow, which bumps the
version, builds, and publishes to PyPI via trusted publishing.
Metadata
Release files for scarfs 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scarfs-0.2.2.tar.gz | 51.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scarfs-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.4 kB
Release files / scarfs-0.2.2.tar.gz
| Download URL | scarfs-0.2.2.tar.gz |
|---|---|
| Size | 51.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9f162ce4af6f9448fc10ebbb561f90ce1a421a07b810d2836802d3afcac07f2
|
|
BLAKE2b-256 checksum How to use checksums |
1feb52e7c5a87b5fa8dff1c8025d1d8b91ac60787bc8210f50ce0a00f0d32dec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.
Transparency logRelease files / scarfs-0.2.2-py3-none-any.whl
| Download URL | scarfs-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a2c807b9e104b264b29eb9752fe1324aa402e20b0ea191136a72b0e97e8cdf4
|
|
BLAKE2b-256 checksum How to use checksums |
71d9d85508b07ffb9e23d9417049c2011a419c711372f0c749d9a08d11d70dc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.
Transparency log