Errors and Warnings¶
Solvers report a result they cannot vouch for instead of returning it
silently. A failed solve raises; a suspicious one warns. Pass
Options(strict=False) to turn a failure into a warning and keep the
partial result.
Exception and warning types raised by OpenQuantumSim.
The hierarchy separates three situations a user may need to tell apart:
the Julia backend could not be started (
JuliaBridgeUnavailable),the backend raised an error while running (
BackendError), anda solver ran but did not produce a trustworthy answer (
SolverError,ConvergenceError, and theSolverHealthWarningwarning).
- exception openquantumsim.errors.OpenQuantumSimError[source]¶
Bases:
ExceptionBase class for errors raised by OpenQuantumSim.
- exception openquantumsim.errors.BackendError(message, *, julia_type=None)[source]¶
Bases:
OpenQuantumSimError,RuntimeErrorThe Julia backend raised an error.
julia_typeholds the name of the Julia exception type when it is known, for example"DimensionMismatch".- Parameters:
message (str)
julia_type (str | None)
- Return type:
None
Bases:
BackendError,NotImplementedErrorThe Julia backend could not be loaded.
This also derives from
NotImplementedErrorbecause solver entry points raised that type before a dedicated exception existed.- Parameters:
message (str)
julia_type (str | None)
- Return type:
None
- exception openquantumsim.errors.SolverError(message, *, solver_stats=None)[source]¶
Bases:
OpenQuantumSimError,RuntimeErrorA solver finished without a trustworthy result.
solver_statscarries the statistics reported by the backend, including the return code that triggered the error.- Parameters:
message (str)
solver_stats (Mapping[str, Any] | None)
- Return type:
None
- exception openquantumsim.errors.ConvergenceError(message, *, solver_stats=None)[source]¶
Bases:
SolverErrorAn iterative method (Krylov exponentiation or GMRES) did not converge.
- Parameters:
message (str)
solver_stats (Mapping[str, Any] | None)
- Return type:
None
- exception openquantumsim.errors.SolverHealthWarning[source]¶
Bases:
UserWarningA solver result may be inaccurate.
Emitted when conserved quantities drift beyond the expected tolerance, or in place of
SolverErrorwhenOptions(strict=False)is used.