Upgrade Guide

This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the changelog.

Unreleased

The unreleased API refresh replaces free functions and deep module paths with a small set of top-level types. The pieces fit together: construct physics objects and parameters, run through Simulator, read everything from Result.

Breaking changes at a glance

Area

Before

After

Entry point

mqt.yaqs.simulator.run(...)

Simulator(...).run(...) → returns Result

Imports

mqt.yaqs.core.data_structures.*, gate_library for observables

from mqt.yaqs import State, Hamiltonian, Observable, ...

State / Hamiltonian

Raw MPS / MPO passed to run

State and Hamiltonian (set representation on State)

Observables

Observable(Z(), sites=0) via gate_library

Observable("z", sites=0) — also "entropy", "schmidt_spectrum", etc.

Outputs

Written onto *SimParams / Observable.results

Read from Result (expectation_values, counts, output_state, …)

SVD truncation

threshold on *SimParams

svd_threshold (presets use the same key in SIMULATION_PRESETS)

Execution UI

show_progress on *SimParams

show_progress on Simulator; num_threads removed (unused)

Equivalence checking

digital.equivalence_checker.run(...)

EquivalenceChecker(...).check(...)

Matrix auto cutover

from mqt.yaqs import DEFAULT_MATRIX_MAX_QUBITS

Default is 7 on EquivalenceChecker(matrix_max_qubits=...); constant lives in mqt.yaqs.equivalence_checker only

Bond diagnostics

Observable("max_bond") etc. in observables

result.max_bond, result.total_bond, result.runtime_cost

Result field map

Simulator.run no longer mutates the *SimParams you pass in. result.sim_params references your original configuration unchanged.

Old (sim_params / Observable)

New (result)

sim_params.observables[i].results

result.expectation_values[i]

sim_params.output_state

result.output_state

sim_params.noise_model

result.noise_model

sim_params.results (weak)

result.counts

sim_params.measurements

result.measurements

sim_params.multi_time_observables_times

result.multi_time_times

sim_params.multi_time_observables_results

result.multi_time_results

Removed from *SimParams: noise_model, output_state, multi_time_observables_times, multi_time_observables_results, measurements, results, aggregate_trajectories, aggregate_measurements. Observable configuration (observables, multi_time_observables, etc.) stays on *SimParams.

For MPS-backed analog and strong-digital runs, result.runtime_cost, result.max_bond, and result.total_bond are filled automatically (aligned with result.times or the strong-sim layer grid). MCWF, Lindblad, and weak digital runs leave these as None.

Top-level public API

from mqt.yaqs import (
    AnalogSimParams,
    EquivalenceChecker,
    Hamiltonian,
    MPO,
    MPS,
    NoiseModel,
    Observable,
    Result,
    SIMULATION_PRESETS,
    Simulator,
    State,
    StrongSimParams,
    WeakSimParams,
)

Representation is not exported at the top level (the name means different things on State vs Hamiltonian). Custom gates and circuits still use mqt.yaqs.core.libraries when needed.

Platform note

Starting with this release, x86 macOS is no longer tested in CI; we cannot guarantee that MQT YAQS installs and runs correctly on those systems.

0.3.2

End of support for Python 3.9

Starting with this release, MQT YAQS no longer supports Python 3.9. This is in line with the scheduled end of life of the version. As a result, MQT YAQS is no longer tested under Python 3.9 and requires Python 3.10 or later.