veloxpm is a CUDA-accelerated matrix exponential library with Python bindings.
It provides two execution paths:
ExpMatFloat32andExpMatFloat64computeexp(H)for real input matrices.ExpMatComplex64andExpMatComplex128accept a real matrixHand computeexp(iH)using the optimized imaginary-form implementation.
- CUDA backend built on cuBLAS and cuSolver
- Support for
float32,float64,complex64, andcomplex128 - Wheel packaging for Python installation
- Pytest coverage for small reference cases and larger random diagonal cases
- Python 3.10+
- CUDA toolkit available to CMake/NVCC
- NumPy
From the project root:
python setup.py bdist_wheel
pip install dist/veloxpm-2025.6012a0-*.whlThe generated wheel is written to dist/.
python setup.py installimport numpy as np
from veloxpm import ExpMatFloat32, ExpMatComplex64
H_real = np.array([[0.0, 0.25], [-0.5, 0.0]], dtype=np.float32)
with ExpMatFloat32(2) as calc:
exp_h = calc.run(H_real)
H_imag = np.array([[0.0, 1.0], [1.0, 0.0]], dtype=np.float32)
with ExpMatComplex64(2) as calc:
exp_ih = calc.run(H_imag)If you need to evaluate many matrices with the same shape, create the calculator once and reuse it:
import numpy as np
from veloxpm import ExpMatFloat32, ExpMatComplex64
N = 1024
expMator_real = ExpMatFloat32(N)
expMator_imag = ExpMatComplex64(N)
A_real = np.random.randn(N, N).astype(np.float32)
H_imag = np.random.randn(N, N).astype(np.float32)
exp_a = expMator_real.run(A_real) # computes exp(A_real)
exp_ih = expMator_imag.run(H_imag) # computes exp(iH_imag)
expMator_real.free()
expMator_imag.free()Equivalent shorthand:
expMator = ExpMatFloat32(N) # or ExpMatFloat64 / ExpMatComplex64 / ExpMatComplex128
result = expMator.run(A) # A must be an N x N matrix
expMator.free()For the real-valued calculators:
from scipy.linalg import expm
exp_h = expm(H_real)For the optimized complex calculators, note the semantic difference carefully:
from scipy.linalg import expm
# veloxpm ExpMatComplex64/128 expects a real matrix H
# and computes exp(iH) internally
exp_ih = expm(1j * H_imag)Run the packaged tests with:
cd ./test
python test_complex64.pyThe main functional test file is:
test/test_float32.pytest/test_float64.pytest/test_complex64.pytest/test_complex128py
ExpMatComplex64andExpMatComplex128expect a real matrixH, not a complex matrix.- The complex calculators compute
exp(iH)internally.
veloxpm is the core matrix-exponential computation component used in the FastCTQW simulator introduced in the following publication:
He, X., Ma, S., Qiang, X. (2026). FastCTQW: A GPU-Accelerated Simulator for Ultra-large Scale Continuous-Time Quantum Walks. In: Li, X., Wu, J., Zhang, J. (eds) Quantum Computation. CQCC 2025. Communications in Computer and Information Science, vol 2733. Springer, Singapore. https://doi.org/10.1007/978-981-95-4791-3_4
If you use this library in academic work, please cite the above reference.