Skip to main content

find approximate fixed points of bounded vector valued functions

Project description

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.

Project details


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.0.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.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scarfs-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 d7929eedc51b1748f0964119bb9de7e90bc5f1316ffb09a79a60976eb4eda1d1
MD5 9bf389dc6fd615ef434a2fcd61b88959
BLAKE2b-256 a8cd1bd0dc6727a8831c06ac373187e795deeed630ed1dfab0ae0ba0874326f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for scarfs-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: scarfs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ed25031e1ce37ae28c56cacff3c4c71b1a0a0e8cab9dffba1fcbad84fab3750
MD5 ba1b49b9c3776690677b5d5454d15f02
BLAKE2b-256 4e1f79c7632d8e5bf37e9819b575ead9dc563d5fcaa6da0ef6144aee1b3eac78

See more details on using hashes here.

Provenance

The following attestation bundles were made for scarfs-0.2.0-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 Pingdom Monitoring Sentry Error logging StatusPage Status page