Skip to main content

Scarfs

pypi build docs

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. 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.

Also note that this library "trusts" you, so if you pass in invalid inputs, you may get arcane errors.

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scarfs-0.2.1.tar.gz (51.0 kB view details)

Uploaded Source

Built Distribution

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

scarfs-0.2.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file scarfs-0.2.1.tar.gz.

File metadata

  • Download URL: scarfs-0.2.1.tar.gz
  • Upload date:
  • Size: 51.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scarfs-0.2.1.tar.gz
Algorithm Hash digest
SHA256 395ad1c452d038922cb466a8f121e68d8a11773457c16c0b35dbc71ebf2773bd
MD5 795fb2cf440103def079373168f7c2db
BLAKE2b-256 d59d3f8a3d4219ede7e8f42b8afc5a31143117935ae3f98bdc494ae36cb66237

See more details on using hashes here.

Provenance

The following attestation bundles were made for scarfs-0.2.1.tar.gz:

Publisher: release.yml on erikbrinkman/scarfs

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

File details

Details for the file scarfs-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: scarfs-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scarfs-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8ae27c24ad1cddf23d350e7373a6075d08993836d4981f65ddb378f2da03281
MD5 04bb1a0aeca0c71a83e4bac7d2f93eb8
BLAKE2b-256 186fa2d1fc2d49991f569aebb40701bc2001383c90238e833651b2b020a14f26

See more details on using hashes here.

Provenance

The following attestation bundles were made for scarfs-0.2.1-py3-none-any.whl:

Publisher: release.yml on erikbrinkman/scarfs

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 Sentry Error logging StatusPage Status page