"""Exceptions and Errors raised by QNET"""
__all__ = [
'AlgebraException', 'AlgebraError', 'InfiniteSumError', 'CannotSimplify',
'CannotConvertToSLH', 'CannotVisualize', 'WrongCDimError',
'IncompatibleBlockStructures', 'CannotEliminateAutomatically',
'BasisNotSetError', 'UnequalSpaces', 'OverlappingSpaces',
'SpaceTooLargeError', 'CannotSymbolicallyDiagonalize',
'BadLiouvillianError', 'NonSquareMatrix', 'NoConjugateMatrix']
[docs]class AlgebraException(Exception):
"""Base class for all algebraic exceptions"""
pass
[docs]class AlgebraError(AlgebraException):
"""Base class for all algebraic errors"""
pass
[docs]class InfiniteSumError(AlgebraError):
"""Raised when expanding a sum into an infinite number of terms"""
pass
[docs]class CannotSimplify(AlgebraException):
"""Raised when a rule cannot further simplify an expression"""
pass
[docs]class CannotConvertToSLH(AlgebraException):
"""Raised when a circuit algebra object cannot be converted to SLH"""
[docs]class CannotVisualize(AlgebraException):
"""Raised when a circuit cannot be visually represented."""
[docs]class WrongCDimError(AlgebraError):
"""Raised for mismatched channel number in circuit series"""
[docs]class IncompatibleBlockStructures(AlgebraError):
"""Raised for invalid block-decomposition
This is raised when a circuit decomposition into a block-structure is
requested that is icompatible with the actual block structure of the
circuit expression."""
[docs]class CannotEliminateAutomatically(AlgebraError):
"""Raised when attempted automatic adiabatic elimination fails."""
[docs]class BasisNotSetError(AlgebraError):
"""Raised if the basis or a Hilbert space dimension is unavailable"""
[docs]class UnequalSpaces(AlgebraError):
"""Raised when objects fail to be in the same Hilbert space.
This happens for example when trying to add two states from different
Hilbert spaces."""
[docs]class OverlappingSpaces(AlgebraError):
"""Raised when objects fail to be in separate Hilbert spaces."""
[docs]class CannotSymbolicallyDiagonalize(AlgebraException):
"""Matrix cannot be diagonalized analytically.
Signals that a fallback to numerical diagonalization is required.
"""
[docs]class BadLiouvillianError(AlgebraError):
"""Raised when a Liouvillian is not of standard Lindblad form."""
pass
[docs]class NonSquareMatrix(AlgebraError):
"""Raised when a :class:`.Matrix` fails to be square"""
[docs]class NoConjugateMatrix(AlgebraError):
"""Raised when entries of :class:`.Matrix` have no defined conjugate"""