Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
53815fa
updated to adaptive Lanczos and changed dense path
aaronleesander Jan 29, 2026
91fd995
added eigendecomposition caching to matrix exponential
aaronleesander Jan 29, 2026
356d3a0
added numba path for large tensors
aaronleesander Jan 30, 2026
d171e68
updated comments and docstrings
aaronleesander Jan 30, 2026
b637e66
lanczos method removed where unneeded
aaronleesander Jan 30, 2026
e3c8926
ruff and ty fixes
aaronleesander Jan 30, 2026
bd4acdf
Added numba path for dense Hamiltonian path
aaronleesander Jan 30, 2026
33a4e78
updated docs
aaronleesander Jan 30, 2026
2efee31
fixed ruff and ty errors
aaronleesander Jan 30, 2026
4b2f7d4
Merge branch 'main' into lanczos-speedup
aaronleesander Jan 30, 2026
ae347ff
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 30, 2026
6a7ae24
updated changelog
aaronleesander Jan 30, 2026
658f044
removed unneeded ruff flags
aaronleesander Jan 30, 2026
baf10ce
set ordering for numba
aaronleesander Jan 30, 2026
2568f7b
fixed versioning and ty errors
aaronleesander Jan 30, 2026
6c698b2
updated changelog
aaronleesander Jan 30, 2026
21cff91
updated numba dependencies
aaronleesander Jan 30, 2026
2c381a2
Merge branch 'main' into lanczos-speedup
aaronleesander Jan 31, 2026
d4183e9
pre-commit update
aaronleesander Jan 31, 2026
9e7beca
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 31, 2026
e25e9e1
fix pre-commit
aaronleesander Jan 31, 2026
60c0677
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 31, 2026
cd4cb69
update pre-commit
aaronleesander Jan 31, 2026
2618846
new dependency requires tests to be skipped on macos with Python 3.14
aaronleesander Jan 31, 2026
9ba549f
skip mac intel tests due to missing wheels
aaronleesander Jan 31, 2026
d2d3980
Update .pre-commit-config.yaml
aaronleesander Jan 31, 2026
29c48b7
Update .pre-commit-config.yaml
aaronleesander Jan 31, 2026
2b9ace1
Update CHANGELOG.md
aaronleesander Jan 31, 2026
600bf77
Update CHANGELOG.md
aaronleesander Jan 31, 2026
a0de445
Update noxfile.py
aaronleesander Jan 31, 2026
f9524be
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 31, 2026
652ae2d
dropped suport for x86 macOS
aaronleesander Jan 31, 2026
75e6b67
🎨 pre-commit fixes
pre-commit-ci[bot] Jan 31, 2026
6efdbe6
fixed typo
aaronleesander Jan 31, 2026
838e0ab
update uv.lock to fix pre-commit error
aaronleesander Feb 1, 2026
6207427
Merge branch 'lanczos-speedup' of https://github.com/munich-quantum-t…
aaronleesander Feb 1, 2026
d9aec4e
Update ci.yml
burgholzer Feb 1, 2026
6721aea
Update CHANGELOG.md
burgholzer Feb 1, 2026
e34e49d
removed 0.3.3 reference
aaronleesander Feb 1, 2026
fb0864f
Merge branch 'lanczos-speedup' of https://github.com/munich-quantum-t…
aaronleesander Feb 1, 2026
1e9ba8e
Merge branch 'main' into lanczos-speedup
aaronleesander Feb 2, 2026
880f6a7
uv lock regenerated
aaronleesander Feb 2, 2026
54bac29
reduced test sizes for test speedup
aaronleesander Feb 2, 2026
00a7ad4
capped parallel workers during testing
aaronleesander Feb 3, 2026
61fffab
lowered number of trajectories to speed up slow tests
aaronleesander Feb 3, 2026
2df689a
minimum tests reduced to one OS to speed up test suite
aaronleesander Feb 3, 2026
38084f5
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 3, 2026
5eccd52
updated docstrings
aaronleesander Feb 3, 2026
c044877
Merge branch 'lanczos-speedup' of https://github.com/munich-quantum-t…
aaronleesander Feb 3, 2026
384ba16
updated thresholds
aaronleesander Feb 3, 2026
e68da4c
disabled numba for testing
aaronleesander Feb 3, 2026
86e0b6f
updated thresholds
aaronleesander Feb 3, 2026
f0a445f
removed unneeded error check
aaronleesander Feb 3, 2026
59b2ea9
removed comment
aaronleesander Feb 3, 2026
9af45b0
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 3, 2026
d51d419
updated minimums check
aaronleesander Feb 3, 2026
e769fe2
added ruff exception to numba import
aaronleesander Feb 3, 2026
0174612
merge
aaronleesander Feb 3, 2026
3b3bf97
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 3, 2026
34ea3bc
increased trajectories in tests
aaronleesander Feb 3, 2026
77c61cc
Merge branch 'lanczos-speedup' of https://github.com/munich-quantum-t…
aaronleesander Feb 3, 2026
1000b30
added catch for OSError
aaronleesander Feb 3, 2026
966cae3
added ruff exception
aaronleesander Feb 4, 2026
4f199b2
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 4, 2026
b97bc3d
simplified long range noise test for stability
aaronleesander Feb 4, 2026
09f89d2
updated comment
aaronleesander Feb 4, 2026
62c8d10
added tests for numba implementation
aaronleesander Feb 4, 2026
c03f3a3
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 4, 2026
d4fff73
ruff and ty fixes
aaronleesander Feb 4, 2026
11904b2
import fixes
aaronleesander Feb 4, 2026
4bf3c65
removed unneeded variable
aaronleesander Feb 4, 2026
e3bcba3
change test value to fortran array
aaronleesander Feb 4, 2026
a740107
fixed unneeded lines in test
aaronleesander Feb 4, 2026
2d3676c
added ruff exception
aaronleesander Feb 4, 2026
1823246
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 4, 2026
004897a
added explicit check for numba path
aaronleesander Feb 4, 2026
b05ab9b
ruff fixes
aaronleesander Feb 4, 2026
23e5f35
fixed CodeCov result by disabling JIT for coverage
aaronleesander Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on:
[
ubuntu-24.04,
ubuntu-24.04-arm,
macos-15-intel,
macos-14,
windows-2022,
]
runs-on: [ubuntu-24.04, ubuntu-24.04-arm, macos-15, windows-2025]
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-tests.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ repos:
- id: ty-check
name: ty check
entry: uv run ty check
language: unsupported
language: system
require_serial: true
types_or: [python, pyi, jupyter]
exclude: ^(docs/)
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ This project adheres to [Semantic Versioning], with the exception that minor rel

### Changed

- Changed Pauli summation to use finite state machine construction ([`#308`]) ([**@aaronleesander**])
- 👷‍♂️ Stop testing on x86 macOS systems ([#310]) ([**@aaronleesander**])
- ⚡️ Improve Lanczos iteration and use numba for significant speedup ([#310]) ([**@aaronleesander**])
- ♻️ Change Pauli summation to use finite state machine construction ([#308]) ([**@aaronleesander**])
- 🔧 Replace `mypy` with `ty` ([#304]) ([**@denialhaag**])

## [0.3.3] - 2026-01-12
Expand Down Expand Up @@ -61,6 +63,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool

<!-- PR links -->

[#310]: https://github.com/munich-quantum-toolkit/yaqs/pull/310
[#308]: https://github.com/munich-quantum-toolkit/yaqs/pull/308
[#304]: https://github.com/munich-quantum-toolkit/yaqs/pull/304
[#298]: https://github.com/munich-quantum-toolkit/yaqs/pull/298
Expand Down
7 changes: 6 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ This document describes breaking changes and how to upgrade. For a complete list

## [Unreleased]

### End of support for x86 macOS systems

Starting with this release, we can no longer guarantee support for x86 macOS systems.
x86 macOS systems are no longer tested in our CI and we can no longer guarantee that MQT YAQS installs and runs correctly on them.

## [0.3.2]

### End of support for Python 3.9
Expand All @@ -14,5 +19,5 @@ As a result, MQT YAQS is no longer tested under Python 3.9 and requires Python 3

<!-- Version links -->

[unreleased]: https://github.com/munich-quantum-toolkit/yaqs/compare/v0.3.2...HEAD
[Unreleased]: https://github.com/munich-quantum-toolkit/yaqs/compare/v0.3.3...HEAD
[0.3.2]: https://github.com/munich-quantum-toolkit/yaqs/compare/v0.3.1...v0.3.2
4 changes: 3 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def _run_tests(
if "--cov" in session.posargs:
# try to use the lighter-weight `sys.monitoring` coverage core
env["COVERAGE_CORE"] = "sysmon"
# disable Numba JIT coverage
env["NUMBA_DISABLE_JIT"] = "1"

session.run(
"uv",
Expand All @@ -89,7 +91,7 @@ def tests(session: nox.Session) -> None:
_run_tests(session)


@nox.session(python=PYTHON_ALL_VERSIONS, reuse_venv=True, venv_backend="uv", default=True)
@nox.session(python=PYTHON_ALL_VERSIONS, reuse_venv=True, venv_backend="uv")
def minimums(session: nox.Session) -> None:
"""Test the minimum versions of dependencies."""
with preserve_lockfile():
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ dependencies = [
"qiskit>=1.3.0; python_version >= '3.13'",
"opt-einsum>=3.4.0",
"tqdm>=4.67.1",
"numba>=0.61.0",
"numba>=0.63.0; python_version >= '3.14'",
Comment thread
aaronleesander marked this conversation as resolved.
]

[project.urls]
Expand Down
100 changes: 100 additions & 0 deletions src/mqt/yaqs/core/methods/lanczos_numba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Copyright (c) 2025 - 2026 Chair for Design Automation, TUM
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License

"""Numba-accelerated Lanczos methods."""

from __future__ import annotations

import numpy as np
from numba import jit


@jit(nopython=True, cache=True, fastmath=True)
def orthogonalize_step(
v: np.ndarray,
w: np.ndarray,
j: int,
alpha: np.ndarray,
beta: np.ndarray,
) -> float:
"""Perform the orthogonalization step of the Lanczos iteration.

Computes alpha[j] = <v_j, w>, orthogonalizes w against v_j and v_{j-1},
and computes the norm beta[j] = ||w||.

Args:
v: (N, m) matrix of Lanczos vectors. Columns should be contiguous (F-order) for best performance.
w: (N,) candidate vector. Modified in-place.
j: Current iteration index.
alpha: (m,) diagonal elements.
beta: (m-1,) off-diagonal elements.

Returns:
float: The norm of the orthogonalized vector (beta[j]), or 0.0 if not computed.
"""
# Note: v[:, j] creates a view. If v is F-ordered, this view is contiguous.
vj = v[:, j]

# 1. alpha_j = <v_j, w>
aj = np.vdot(vj, w).real
alpha[j] = aj

# 2. w <- w - aj * vj
w_len = w.size
for i in range(w_len):
w[i] -= aj * vj[i]

# 3. Orthogonalize against v_{j-1} if applicable
if j > 0:
v_prev = v[:, j - 1]
b_prev = beta[j - 1]
for i in range(w_len):
w[i] -= b_prev * v_prev[i]

# 4. Compute norm
norm_sq = 0.0
for i in range(w_len):
val = w[i]
norm_sq += val.real * val.real + val.imag * val.imag

bj = np.sqrt(norm_sq)

if j < len(beta):
beta[j] = bj

return bj


@jit(nopython=True, cache=True, fastmath=True)
def normalize_and_store(v: np.ndarray, w: np.ndarray, j: int, bj: float) -> None:
"""Normalize a Lanczos vector and store it in the Lanczos basis matrix.

This helper function completes the Lanczos iteration by normalizing the
candidate vector `w` by the computed norm `bj` and storing the result
as the next Lanczos vector in column `j+1` of the basis matrix `v`.

If `bj` is zero (indicating loss of orthogonality or convergence), the
normalization is skipped and the column remains unchanged.

Args:
v: (N, m) matrix of Lanczos vectors. Column `j+1` will be overwritten.
Should be F-ordered for optimal memory access.
w: (N,) candidate vector to normalize. Not modified.
j: Current iteration index. The normalized vector is stored in `v[:, j+1]`.
bj: Normalization factor (the computed norm of `w` after orthogonalization).
If `bj <= 0`, normalization is skipped.

Note:
Modifies `v` in-place.
"""
if bj > 0:
inv_bj = 1.0 / bj

# explicit loop
w_len = w.size
for i in range(w_len):
v[i, j + 1] = w[i] * inv_bj
Loading
Loading