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: spmatrix | ndarray, timeStep: float = 1.0) spmatrix | 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).toarray()
array([[1.+2.4492936e-16j, 0.+0.0000000e+00j],
       [0.+0.0000000e+00j, 1.-2.4492936e-16j]])
Liouvillian(Hamiltonian: spmatrix | ndarray | None = None, collapseOperators: List | None = None, decayRates: List | None = None, _double: bool = False) spmatrix | 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]).toarray()
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: spmatrix | ndarray | None = None, timeStep: float = 1.0, collapseOperators: List | None = None, decayRates: List | None = None, exp: bool = True, _double: bool = False) spmatrix | 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, [], []).toarray()
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]).toarray()
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: spmatrix | ndarray, operatorB: spmatrix | ndarray | None = None, identity: spmatrix | ndarray | None = None, _double: bool = False) spmatrix | 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()).toarray()
array([[ 0.,  0.,  0.,  0.],
       [ 0., -2.,  0.,  0.],
       [ 0.,  0., -2.,  0.],
       [ 0.,  0.,  0.,  0.]])
>>> dissipator(sigmam()).toarray()
array([[-1. ,  0. ,  0. ,  0. ],
       [ 0. , -0.5,  0. ,  0. ],
       [ 0. ,  0. , -0.5,  0. ],
       [ 1. ,  0. ,  0. ,  0. ]])
_preSO(operator: spmatrix | ndarray, identity: spmatrix | ndarray = None) spmatrix | 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()).toarray()
array([[0., 0., 0., 0.],
       [1., 0., 0., 0.],
       [0., 0., 0., 0.],
       [0., 0., 1., 0.]])
_postSO(operator: spmatrix | ndarray, identity: spmatrix | ndarray = None) spmatrix | 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()).toarray()
array([[0., 0., 1., 0.],
       [0., 0., 0., 1.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.]])
_prepostSO(operatorA: spmatrix | ndarray, operatorB: spmatrix | ndarray | None = None) spmatrix | 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()).toarray()
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: spmatrix | ndarray | None = None, collapseOperators: List | None = None, decayRates: List | None = None, calcFunc: Callable | None = None, delStates: bool | None = False, _double: bool = False) spmatrix | ndarray[source]#
steadyStateLio(Liouvillian_, LioExp: bool = False, allVecVals: bool = False)[source]#
steadyStateHam(Hamiltonian: spmatrix | ndarray | None = None, collapseOperators: List | None = None, decayRates: List | None = None, _double: bool = False) spmatrix | ndarray[source]#