Collection of small useful helper tools for Python by Johannes Feist.
The jftools.short_iterative_lanczos solver provides two backends:
numbafor array-based propagation.pythonfor the reference implementation.
Select backend behavior with the backend function argument:
auto(default): selectnumbaonly when both the Hamiltonian and the input state are compatible with the Numba implementation; otherwise fall back topython.python: force the original Python implementation.numba: force the Numba backend.
Current Numba compatibility is intentionally narrower than the Python backend:
- States must be
numpy.ndarray(converted tocomplex128) orqutip.Qobjstates. - Hamiltonians may be dense NumPy arrays, SciPy CSR matrices/arrays, callable
Hfun(t, phi, Hphi)operators working on array states, or the specialized sum-operator form(H0, (H1, f1), ...).
The Python backend uses the same NumPy/Qobj-style state handling as the reference implementation.
Example:
prop = jftools.short_iterative_lanczos.lanczos_timeprop(H, maxsteps=14, target_convg=1e-12, backend="auto")jftools is a pure Python package again. There is no compiled extension build step.
Recommended (uv-only) workflow:
uv sync --group dev
uv run python -m pip install -e .For a non-editable local install through uv:
uv run python -m pip install .Short iterative Lanczos targets modern QuTiP (5.x):
- QuTiP Hamiltonians are converted through
H.data.as_scipy()when available. - QuTiP state outputs preserve
dimsand state shape.
Before publishing a new version:
- Update
__version__in jftools/init.py. - Commit the version bump.
- Build locally.
For a local packaging sanity check on your current machine only:
uv build