Skip to main content

zvode

Python bindings to the classic ZVODE ODE solver.

Tests PyPI Python License Docs

ZVODE is a variable-coefficient ODE solver for stiff and non-stiff systems of first-order ordinary differential equations with complex-valued state, written by P. N. Brown, G. D. Byrne, and A. C. Hindmarsh [2]. It is part of ODEPACK and uses a fixed-leading-coefficient Adams or BDF method, selectable by the user.

This package exposes two interfaces to ZVODE:

  • Procedural API — solve_complex_ivp(fun, tspan, y0, ...): a single-call function in the spirit of scipy.integrate.odeint. This is the recommended starting point.
  • OdeSolver API — ZVODE / ZVODE_BDF / ZVODE_Adams: a scipy.integrate.OdeSolver subclass for use with scipy.integrate.solve_ivp.

The underlying Fortran source has been modified; extern/README.md documents the changes.

Warning: This integrator is currently not thread-safe. You cannot have two threads using the ZVODE integrator simultaneously.

Table of Contents:

Installation

pip install zvode          # procedural API only (numpy only)
pip install zvode[scipy]   # also enables ZVODE / ZVODE_BDF / ZVODE_Adams (requires SciPy)

The OdeSolver classes (ZVODE, ZVODE_BDF, ZVODE_Adams) are a SciPy add-on: they subclass scipy.integrate.OdeSolver so they can be passed as the method argument to scipy.integrate.solve_ivp. If your code only uses solve_complex_ivp you do not need SciPy.

To install locally from source:

pip install .              # procedural API only
pip install ".[scipy]"     # also install SciPy
pip install ".[test]"      # run the test suite (includes SciPy)

Quick start

Procedural API — solve_complex_ivp

solve_complex_ivp is the recommended entry point. Pass the RHS function, a time span, and an initial condition; get back a result object with sol.t, sol.y, and integration statistics (sol.nfev, sol.njev, …) as attributes.

from zvode import solve_complex_ivp

def rhs(t, y):
    return [-100j * y[0] + y[1], -1j * y[1]]

def jac(t, y):
    return [[-100j, 1.0], [0.0, -1j]]

sol = solve_complex_ivp(
    fun=rhs,
    tspan=(0.0, 5.0),
    y0=[1.0 + 0j, 0.0 + 1j],
    method='BDF',
    jac=jac,
)

print(sol)

See the documentation for output modes, banded Jacobians, backward integration, compiled callbacks, and other options.

OdeSolver API (scipy-compatible)

Pass a ZVODE_* class as the method argument to scipy.integrate.solve_ivp.

Non-stiff problem — rotating complex exponential:

import numpy as np
from scipy.integrate import solve_ivp
from zvode import ZVODE_Adams

sol = solve_ivp(
    fun=lambda t, y: -1j * y,
    t_span=(0.0, 10.0),
    y0=[1.0 + 0.0j],
    method=ZVODE_Adams,
)

Stiff problem — with a user-supplied Jacobian:

from zvode import ZVODE_BDF

sol = solve_ivp(
    fun=lambda t, y: -1j * y,
    t_span=(0.0, 10.0),
    y0=[1.0 + 0.0j],
    method=ZVODE_BDF,
    jac=lambda t, y: [[-1j]],
)

More OdeSolver examples are in the docs/ folder on GitHub.

Limitations

  • complex floats (fp64) only
  • no event-handling/root-finding capabilities
  • not thread-safe (ZVODE uses global Fortran COMMON blocks)
  • no solution back-tracking available
  • only dense or banded Jacobians
  • no built-in mass matrix support (a constant mass matrix can be handled by pre-factoring with LU decomposition)

Links

ODEPACK & SUNDIALS

Python / R ecosystem

SciPy has historically provided a ZVODE wrapper through scipy.integrate.ode, a stateful, class-based interface (integrator='zvode'). As of SciPy 1.17, the underlying Fortran source was replaced with a C translation of ZVODE that is thread-safe.

Building from source

Building requires a C compiler and a Fortran compiler with Fortran 2003 support. The code has been tested with gfortran (passing -std=f2003).

A BLAS library is required at link time (located by CMake's find_package(BLAS)). On Linux, OpenBLAS or a vendor BLAS (MKL, BLIS, …) should all work. On macOS, the system Accelerate framework is picked up automatically.

# Example: Ubuntu / Debian
sudo apt update
sudo apt install gfortran libopenblas-dev
pip install -v ".[test]"
# Example: macOS (Homebrew)
brew update
brew install gfortran
pip install -v ".[test]"

To control which BLAS library is used, add the option,

pip install ... \
  -C "cmake.args=-DBLA_VENDOR=<blas_vendor>"

The list of BLAS/LAPACK vendors can be found here

Debug build

Passing -DZVODE_DEBUG (equivalent to -DZVODE_DEBUG=1) enables extra assertions and diagnostic output in the C extension:

pip install -v ".[test]" \
  -C "cmake.args=-DCMAKE_C_FLAGS=-DZVODE_DEBUG"

Changelog

See CHANGELOG.md for version history.

License

zvode is distributed under the BSD license. See LICENSE for details.

Contributing

Bug reports and suggestions are welcome via the issue tracker. The most useful reports are:

  • Documentation errors — typos, incorrect parameter descriptions, or misleading examples.
  • Integration failures — cases where the solver returns a wrong result, fails to converge, or raises an unexpected error. A minimal reproducer (ODE, initial condition, tolerances) is very helpful.
  • Feature requests — even if a feature is not planned, requests help track what practitioners actually need.

References

[1] A. C. Hindmarsh, "ODEPACK, A Systematized Collection of ODE Solvers," in Scientific Computing, R. S. Stepleman et al. (eds.), North-Holland, Amsterdam, 1983 (vol. 1 of IMACS Transactions on Scientific Computation), pp. 55–64. https://computing.llnl.gov/projects/odepack

[2] P. N. Brown, G. D. Byrne, and A. C. Hindmarsh, "VODE, A Variable-Coefficient ODE Solver," SIAM J. Sci. Stat. Comput., 10 (1989), pp. 1038–1051. https://doi.org/10.1137/0910062

[3] G. D. Byrne and A. C. Hindmarsh, "A Polyalgorithm for the Numerical Solution of Ordinary Differential Equations," ACM Trans. Math. Soft., 1(1), pp. 71–96, 1975. https://doi.org/10.1145/355626.355636

For a broader perspective on the history and design philosophy behind ODEPACK and related solvers, see the SIAM oral history interview with Alan C. Hindmarsh.

Metadata

Release files for zvode 0.3.0

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

Source distribution (sdist)

Source distribution for zvode 0.3.0
File Size Uploaded
zvode-0.3.0.tar.gz 281.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for zvode 0.3.0
File
zvode-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
zvode-0.3.0-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
zvode-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
zvode-0.3.0-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
zvode-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
zvode-0.3.0-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
zvode-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
zvode-0.3.0-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details
zvode-0.3.0-cp39-cp39-manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.28+ x86-64 Details
zvode-0.3.0-cp39-cp39-macosx_14_0_arm64.whl CPython 3.9 CPython 3.9 macOS 14.0+ ARM64 Details

Total release size: 64.5 MB

Release files / zvode-0.3.0.tar.gz

Download URL zvode-0.3.0.tar.gz
Size 281.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f281670dc24e57ebecaada9d62cbff134ae35261e45520d4251d04aeea046e1d
BLAKE2b-256 checksum
How to use checksums
17a8c1fec9bfc1b5a60355546ddb4db13f0bd3d9f1bb9935c34ff55322a65e18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL zvode-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl
Size 12.0 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b64e92445b07d6e6c1ec6d897094527359a537e5623cb060f6bec086bd0bc5ce
BLAKE2b-256 checksum
How to use checksums
f5f3be060525e4708347dbfddb5d5ca634efd6eff10e53c3f0ef18712ce14074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp313-cp313-macosx_14_0_arm64.whl

Download URL zvode-0.3.0-cp313-cp313-macosx_14_0_arm64.whl
Size 821.3 kB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
98530fe0d9a2b68aa81cc78d15eabbcc4e8711e53fa3a427ac185bcc0a65b5a2
BLAKE2b-256 checksum
How to use checksums
583c68becdb676075a31e0945691bec00c6a7f3fc10d1537d40ee51ffad74887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL zvode-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 12.0 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7ef7fb951d71e4a24da3e542bc2464d72f18afb34384f40228f1ea2f7af13dbd
BLAKE2b-256 checksum
How to use checksums
655a15020392f424067195f84800aa1f5ea8623e7ba95391a7ea18a3fcaea29b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp312-cp312-macosx_14_0_arm64.whl

Download URL zvode-0.3.0-cp312-cp312-macosx_14_0_arm64.whl
Size 821.3 kB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
0417287deeb94ee65e810670ad474284d441974a6313fc81ee195c55ada0d604
BLAKE2b-256 checksum
How to use checksums
28b0790e2afe9ed6de7610dcbc16cca9abca08540337ffc8d641cabb596c5697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL zvode-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 12.0 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
00109b484905cfbd8133438124b9766f910e36ac9d0578749a24d171ddd30bf5
BLAKE2b-256 checksum
How to use checksums
18ac174de2b9ea4d349de3a53880fda7bdcb00cfabe93b4081a4579913b9988d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp311-cp311-macosx_14_0_arm64.whl

Download URL zvode-0.3.0-cp311-cp311-macosx_14_0_arm64.whl
Size 821.3 kB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
77af1043e7972ed09800cc42401c9bd94415829d9d04df7404c89d54b5297218
BLAKE2b-256 checksum
How to use checksums
55f01f7ae3e2ac48ae70c421ce5f5e78598fd565749fd49e8299b1f000017d7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL zvode-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 12.0 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d86b57ee6ba600a2f856a431969a26a594805e3ebb6f3c5551dbf99da8fda347
BLAKE2b-256 checksum
How to use checksums
fe46babd7fc4ba580a8cbe39bafc554ebeba23eb743282ec2e652ff7005cb89a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp310-cp310-macosx_14_0_arm64.whl

Download URL zvode-0.3.0-cp310-cp310-macosx_14_0_arm64.whl
Size 821.3 kB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
eea14686616fe1507293e7b35300d60ab607b2cc0ee288efde69e76c081c04d5
BLAKE2b-256 checksum
How to use checksums
1676e3abebd450176354761b125cd6a42e902098ae606726b180209408dc784e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp39-cp39-manylinux_2_28_x86_64.whl

Download URL zvode-0.3.0-cp39-cp39-manylinux_2_28_x86_64.whl
Size 12.0 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2f168e4c770bd75a00e77b1122c7e5002be627e4c5211480b051324d2fe03264
BLAKE2b-256 checksum
How to use checksums
c70011da816fce539f974bbb0b9f752a8ae60b94308a7e91ae6540addbdc6d9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / zvode-0.3.0-cp39-cp39-macosx_14_0_arm64.whl

Download URL zvode-0.3.0-cp39-cp39-macosx_14_0_arm64.whl
Size 821.3 kB
Tags CPython 3.9 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
f5bf813f56bc2af0d2ff836d26054c853821ffb3ef159eca40491fe83ea76cc1
BLAKE2b-256 checksum
How to use checksums
e1d3ba600acf252470ca7667582b555961e7ef814cdd48c9990c862028935a2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.3.0 This release

11 release files

0.1.0

1 release file

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