Skip to main content

PyPI version CI CD

Fixed-point solver

fxp-jax is a simple implementation of a fixed-point iteration algorithm for root finding in JAX. The implementation allow the user to solve the system of fixed point equations by standard fixed point iterations and the SQUAREM accelerator, see Du and Varadhan (2020).

Installation

pip install fxp-jax

Usage

import jax
import jax.numpy as jnp
from jax import random

from fxp_jax import fxp_root

jax.config.update("jax_enable_x64", True)

accelerator = "SQUAREM"

N = 100

a = random.uniform(random.PRNGKey(111), (N,1))
b = random.uniform(random.PRNGKey(112), (1,1))

def fun(x: jnp.ndarray) -> tuple[jnp.ndarray, jnp.ndarray]:
    y = a + x @ b
    return y, y - x

fxp = fxp_root(fun, accelerator=accelerator)

result = fxp.solve(jnp.zeros_like(a))

y, z = fxp.fun(result.x)

print('--------------------------------------------------------')
print(f'System of fixed-point equations is solved: {jnp.allclose(result.x, y)}.')
print(f'Roots are zero: {jnp.allclose(z, 0.0)}.')
print('--------------------------------------------------------')

Metadata

Release files for fxp-jax 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fxp-jax 0.2.5
File Size Uploaded
fxp_jax-0.2.5.tar.gz 29.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fxp-jax 0.2.5
File Interpreter ABI Platform
fxp_jax-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 34.2 kB

Release files / fxp_jax-0.2.5.tar.gz

Download URL fxp_jax-0.2.5.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a48323ed7f1d79f81aeb377c8bee1d29735b16dcc39c5d953b7fcfa0f206cfa1
BLAKE2b-256 checksum
How to use checksums
fcb99ee38a3a030204e697eff928c7dfe46c65ebb25a4b60ea93b1a1f52e6a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.14

Release files / fxp_jax-0.2.5-py3-none-any.whl

Download URL fxp_jax-0.2.5-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0248328e8a5fd4fa6dfc39645b559945097410bd7eb1bca729fc86c79d9ab103
BLAKE2b-256 checksum
How to use checksums
8c9e77c4bf31fbf544bf3d5730df32d3371e77648ac36f43cfa9efa800a38d7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.14

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.21

2 release files

0.1.20

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page