Skip to main content

find approximate fixed points of bounded vector valued functions

Project description

Scarfs

pypi build

A library to find an approximate fixed point for a for a bounded vector valued function.

Installation

pip install scarfs

Usage

Define the function you want to find a fixed point of using numba:

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.

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.1.1.tar.gz (6.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.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scarfs-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for scarfs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e5d55200c7e91cc7a5b01a705c7debe0f55119a13fd640dfa74cf06ba97612b8
MD5 f0d9e081be9b517b2a7df764a47615ca
BLAKE2b-256 c9671301ddec27c03b080e22d8fc7b9b89a96c111183ee37a0f16814536484ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scarfs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for scarfs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e88e5c35b9fb585e40374192a2a15b4433ef8ae71973d1e62ef6f0f69f1eb99
MD5 7f4adc651ba0962a376547572cd5bccd
BLAKE2b-256 719de56c8992120baf827aff35259c0f379832ebc6b64b5eb0f420778eaca76e

See more details on using hashes here.

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