{"id":27100,"library":"klujax","title":"KLUJAX","description":"A JAX-compatible KLU sparse direct solver for linear systems (LU factorization), useful for circuit simulation and power systems. Version 0.5.0; pre-1.0, breaking changes possible. Cadence: irregular.","status":"active","version":"0.5.0","language":"python","source_language":"en","source_url":"https://github.com/jakevdp/klujax","tags":["jax","klu","sparse","solver","linear-algebra"],"install":[{"cmd":"pip install klujax","lang":"bash","label":"Install"}],"dependencies":[{"reason":"Core dependency for JAX arrays and operations","package":"jax","optional":false},{"reason":"Required for JAX runtime","package":"jaxlib","optional":false}],"imports":[{"note":"klujax is the module, not the solver function. The function is klujax_solve.","wrong":"from klujax import klujax","symbol":"Solver","correct":"from klujax import klujax_solve"}],"quickstart":{"code":"import jax.numpy as jnp\nfrom klujax import klujax_solve\n\n# Define a sparse matrix in COO format\nrow = jnp.array([0, 1, 0, 1], dtype=jnp.int32)\ncol = jnp.array([0, 0, 1, 1], dtype=jnp.int32)\ndata = jnp.array([2.0, 1.0, 1.0, 3.0], dtype=jnp.float64)\nb = jnp.array([1.0, 2.0], dtype=jnp.float64)\n\n# Solve A x = b\nx = klujax_solve(row, col, data, b)\nprint(x)","lang":"python","description":"Solve a sparse linear system using KLU via JAX. Inputs are COO format arrays (row, col, data) and right-hand side b."},"warnings":[{"fix":"Pin version with `klujax==0.5.0` and monitor releases.","message":"Pre-1.0 API may change without notice. The function signature or return type may change in future releases.","severity":"breaking","affected_versions":"all < 1.0"},{"fix":"Ensure inputs are JAX arrays with correct dtypes: `row=jnp.array(..., dtype=jnp.int32)`, `data=jnp.array(..., dtype=jnp.float64)`.","message":"klujax_solve expects row, col, data as JAX int32/int64 and float32/float64 arrays. Using Python lists or incorrect dtypes may cause silent errors or type promotion issues.","severity":"gotcha","affected_versions":"all"},{"fix":"Do not wrap klujax_solve inside `jax.jit`. Use outside JIT context.","message":"The solver is not JIT-compatible by default; current implementation uses Python loops. JIT compilation may fail or produce incorrect results.","severity":"gotcha","affected_versions":"<=0.5.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install klujax` and verify with `python -c 'import klujax; print(klujax.__version__)'`.","cause":"Package not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'klujax'"},{"fix":"Convert inputs to JAX arrays: `row = jnp.array(row_list, dtype=jnp.int32)`.","cause":"Passed Python lists instead of JAX arrays.","error":"TypeError: Expected jnp.ndarray, got list"},{"fix":"Ensure the matrix is square. For rectangular systems, pad or use least squares.","cause":"Solver currently requires square matrices (M=N).","error":"AssertionError: nonsquare matrix"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}