get_unitary_evolver¶
- py_ste.get_unitary_evolver(drift_hamiltonian: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], control_hamiltonians: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], sparse: bool = False, force_dynamic: bool = False) UnitaryEvolver[source]¶
Initialises a class to store the diagonalised drift and control Hamiltonians. On initialisation the Hamiltonians are diagonalised and the eigenvectors and values stored. This initial diagonalisation may be slow and takes \(O(\textrm{dim}^3)\) time for a \(\textrm{dim}\times \textrm{dim}\) Hamiltonian. However, it allows each step of the Suzuki-Trotter expansion to be implimented in \(O(\textrm{dim}^2)\) time with matrix multiplication and only scalar exponentiation opposed to matrix exponentiation which takes \(O(\textrm{dim}^3)\) time.
- Parameters:
drift_hamiltonian (ArrayLike) – The drift Hamiltonian. Must be a square matrix of dimension
dim.control_hamiltonians (ArrayLike) – The control Hamiltonians. Can either by a 3D array with shape
(n_ctrl, dim, dim)representing a stack of control Hamiltonians indexed by the first axis. Alternatively a 3D array with shape(n_ctrl * dim, dim)can be passed with the control Hamiltonians being concatenated along the first axis.sparse (bool, optional) – Whether to use sparse matrices for the evolution. The default is False.
force_dynamic (bool, optional) – Whether to force the use of dynamically sized matrices for the evolution. The default is False.
- Returns:
An instance of a child class of
evolvers.UnitaryEvolver. Ifsparse == Falsethen the returned instance will be a child class ofevolvers.DenseUnitaryEvolverelseevolvers.SparseUnitaryEvolveris returned. Bothevolvers.DenseUnitaryEvolverandevolvers.SparseUnitaryEvolverare dynamic evolvers: evolvers for which the number of control Hamiltonians and the vector space dimension are determined at runtime based on the shapes ofdrift_hamiltonianandcontrol_hamiltonians. If possibleget_unitary_evolver()will return an instance ofevolvers.DenseUnitaryEvolver_nctrl_dimorevolvers.SparseUnitaryEvolver_nctrl_dim, wherenctrlanddimare substituted for their corresponding values. These are fixed evolvers where the number of controls (nctrl) and the vector space dimension (dim) are know at the C++ compile time allowing for more efficient C++ methods to be compiled.Note
An instance of
evolvers.UnitaryEvolveritself will never be returned.evolvers.UnitaryEvolveris simply a base class for all evolvers allowing for checks such as:isinstance(evolver, evolvers.UnitaryEvolver)
- Return type:
- Raises:
ValueError –
drift_hamiltonianmust be 2D.ValueError –
drift_hamiltonianmust be square.ValueError – The control Hamiltonians (
control_hamiltonians) must have the same number of columns asdrift_hamiltonian.ValueError –
control_hamiltoniansmust be 2D or 3D.ValueError – Each control Hamiltonian in
control_hamiltoniansmust have the same dimension asdrift_hamiltonian.