Quantum Evolution (quanguru.QuantumToolbox.evolution)#

Contains functions to create Unitary and open-system super-operators.

Functions#

Unitary(Hamiltonian[, timeStep])

Creates Unitary time evolution operator U(t) := e^{-i\hat{H}t} for a given Hamiltonian \hat{H} and time step t.

Liouvillian([Hamiltonian, ...])

TODO : I have generalised the functions, docs need to be updated.

LiouvillianExp([Hamiltonian, timeStep, ...])

For a time step t, creates Liouvillian \hat{\mathcal{L}} and exponentiate it, or unitary U(t) for a Hamiltonian \hat{H}.

dissipator(operatorA[, operatorB, identity, ...])

TODO : I have generalised the functions, docs need to be updated.

_preSO(operator[, identity])

Creates pre super-operator \mathbb{I}\otimes\hat{O} for an operator \hat{O}.

_postSO(operator[, identity])

Creates pos super-operator \hat{O}^{T}\otimes\mathbb{I} for an operator \hat{O}.

_prepostSO(operatorA[, operatorB])

TODO : I have generalised the functions, docs need to be updated.

Function Name

Docstrings

Examples

Unit Tests

Tutorials

Unitary

      ✅

    ✅

    ❌

    ❌

Liouvillian

      ✅

    ✅

    ❌

    ❌

LiouvillianExp

      ✅

    ✅

    ❌

    ❌

dissipator

      ✅

    ✅

    ✅

    ❌

_preSO

      ✅

    ✅

    ✅

    ❌

_postSO

      ✅

    ✅

    ✅

    ❌

_prepostSO

      ✅

    ✅

    ✅

    ❌

Unitary(Hamiltonian: Union[scipy.sparse._base.spmatrix, numpy.ndarray], timeStep: float = 1.0) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates Unitary time evolution operator U(t) := e^{-i\hat{H}t} for a given Hamiltonian \hat{H} and time step t.

Keeps sparse/array as sparse/array.

Parameters
  • Hamiltonian (Matrix) – Hamiltonian of the system

  • timeStep (float) – time used in the exponentiation (default=1.0)

Returns

Unitary time evolution operator

Return type

Matrix

Examples

>>> Unitary(2*np.pi*sigmaz(), 1).A
array([[1.+2.4492936e-16j, 0.+0.0000000e+00j],
       [0.+0.0000000e+00j, 1.-2.4492936e-16j]])
Liouvillian(Hamiltonian: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None, collapseOperators: Optional[List] = None, decayRates: Optional[List] = None, _double: bool = False) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

TODO : I have generalised the functions, docs need to be updated. Creates Liouvillian super-operator \hat{\mathcal{L}} := -i(\hat{H}\otimes\mathbb{I} + \mathbb{I}\otimes\hat{H}) +
\sum_{i}\kappa_{i}\hat{\mathcal{D}}(\hat{c}_{i}) for a Hamiltonian \hat{H} and collapse operators \{\hat{c}_{i}\} (with corresponding decay rates \{\kappa_{i}\}).

Keeps sparse/array as sparse/array.

Parameters
  • Hamiltonian (Matrix or None) – Hamiltonian of the system

  • collapseOperators (list (of Matrix)) – list of collapse operator for Lindblad dissipator terms

  • decayRates` (list (of float)) – list of decay rates (if not given assumed to be 1)

Returns

Liouvillian super-operator

Return type

Matrix

Examples

>>> Liouvillian(2*np.pi*sigmaz(), [2*np.pi*sigmaz()], [1]).A
array([[  0.         +0.j        ,   0.         +0.j        ,
          0.         +0.j        ,   0.         +0.j        ],
       [  0.         +0.j        , -78.95683521+12.56637061j,
          0.         +0.j        ,   0.         +0.j        ],
       [  0.         +0.j        ,   0.         +0.j        ,
        -78.95683521-12.56637061j,   0.         +0.j        ],
       [  0.         +0.j        ,   0.         +0.j        ,
          0.         +0.j        ,   0.         +0.j        ]])
LiouvillianExp(Hamiltonian: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None, timeStep: float = 1.0, collapseOperators: Optional[List] = None, decayRates: Optional[List] = None, exp: bool = True, _double: bool = False) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

For a time step t, creates Liouvillian \hat{\mathcal{L}} and exponentiate it, or unitary U(t) for a Hamiltonian \hat{H}.

Keeps sparse/array as sparse/array.

Parameters
  • Hamiltonian (Matrix or None) – Hamiltonian of the system

  • timeStep (float) – time used in the exponentiation (default=1)

  • collapseOperators (list (of Matrix)) – list of collapse operator for Lindblad dissipator terms

  • decayRates (list (of float)) – list of decay rates (if not given assumed to be 1)

  • exp (bool) – boolean to exponentiate the Liouvillian or not (=True by default)

Returns

(exponentiated) Liouvillian super-operator

Return type

Matrix

Examples

>>> LiouvillianExp(2*np.pi*sigmaz(), 1, [], []).A
array([[1.+2.4492936e-16j, 0.+0.0000000e+00j],
       [0.+0.0000000e+00j, 1.-2.4492936e-16j]])
>>> LiouvillianExp(2*np.pi*sigmaz(), 1, [2*np.pi*sigmaz()], [1]).A
array([[1.00000000e+00+0.00000000e+00j, 0.00000000e+00+0.00000000e+00j,
        0.00000000e+00+0.00000000e+00j, 0.00000000e+00+0.00000000e+00j],
       [0.00000000e+00+0.00000000e+00j, 5.12250228e-35-2.50930241e-50j,
        0.00000000e+00+0.00000000e+00j, 0.00000000e+00+0.00000000e+00j],
       [0.00000000e+00+0.00000000e+00j, 0.00000000e+00+0.00000000e+00j,
        5.12250228e-35+2.50930241e-50j, 0.00000000e+00+0.00000000e+00j],
       [0.00000000e+00+0.00000000e+00j, 0.00000000e+00+0.00000000e+00j,
        0.00000000e+00+0.00000000e+00j, 1.00000000e+00+0.00000000e+00j]])
dissipator(operatorA: Union[scipy.sparse._base.spmatrix, numpy.ndarray], operatorB: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None, identity: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None, _double: bool = False) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

TODO : I have generalised the functions, docs need to be updated. Creates the Lindblad dissipator super-operator \hat{\mathcal{D}}(\hat{c}) := (\hat{c}^{\dagger})^{T}\otimes\hat{c} -
0.5(\mathbb{I}\otimes\hat{c}^{\dagger}\hat{c} + \hat{c}^{\dagger}\hat{c}\otimes\mathbb{I}) for a collapse operator \hat{c}.

Keeps sparse/array as sparse/array.

Parameters
  • collapseOperator (Matrix) – a collapse operator

  • identity (Matrix or None) – identity operator (exist for internal use and optimisation)

Returns

Lindblad dissipator

Return type

Matrix

Examples

>>> dissipator(sigmaz()).A
array([[ 0.,  0.,  0.,  0.],
       [ 0., -2.,  0.,  0.],
       [ 0.,  0., -2.,  0.],
       [ 0.,  0.,  0.,  0.]])
>>> dissipator(sigmam()).A
array([[-1. ,  0. ,  0. ,  0. ],
       [ 0. , -0.5,  0. ,  0. ],
       [ 0. ,  0. , -0.5,  0. ],
       [ 1. ,  0. ,  0. ,  0. ]])
_preSO(operator: Union[scipy.sparse._base.spmatrix, numpy.ndarray], identity: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates pre super-operator \mathbb{I}\otimes\hat{O} for an operator \hat{O}.

Keeps sparse/array as sparse/array.

Parameters
  • operator (Matrix) – a collapse operator

  • identity (Matrix or None) – identity operator (exist for internal use and optimisations)

Returns

pre super-operator

Return type

Matrix

Examples

>>> evolution._preSO(sigmam()).A
array([[0., 0., 0., 0.],
       [1., 0., 0., 0.],
       [0., 0., 0., 0.],
       [0., 0., 1., 0.]])
_postSO(operator: Union[scipy.sparse._base.spmatrix, numpy.ndarray], identity: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

Creates pos super-operator \hat{O}^{T}\otimes\mathbb{I} for an operator \hat{O}.

Keeps sparse/array as sparse/array.

Parameters
  • operator (Matrix) – a collapse operator

  • identity (Matrix or None) – identity operator (exist for internal use and optimisations)

Returns

post super-operator

Return type

Matrix

Examples

>>> evolution._postSO(sigmam()).A
array([[0., 0., 1., 0.],
       [0., 0., 0., 1.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.]])
_prepostSO(operatorA: Union[scipy.sparse._base.spmatrix, numpy.ndarray], operatorB: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#

TODO : I have generalised the functions, docs need to be updated. Creates pre-pos super-operator (\hat{B}^{\dagger})^{T}\otimes\hat{A} for an operator \hat{O}.

Keeps sparse/array as sparse/array.

Parameters
  • operatorA (Matrix) – collapse operator A

  • operatorB (Matrix) – collapse operator B

Returns

pre-post super-operator

Return type

Matrix

Examples

>>> evolution._prepostSO(sigmam()).A
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0],
       [1, 0, 0, 0]], dtype=int64)
evolveOpen(initialState, totalTime, timeStep: float = 1.0, Hamiltonian: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None, collapseOperators: Optional[List] = None, decayRates: Optional[List] = None, calcFunc: Optional[Callable] = None, delStates: Optional[bool] = False, _double: bool = False) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#
steadyState(Hamiltonian: Optional[Union[scipy.sparse._base.spmatrix, numpy.ndarray]] = None, collapseOperators: Optional[List] = None, decayRates: Optional[List] = None, _double: bool = False) Union[scipy.sparse._base.spmatrix, numpy.ndarray][source]#