mindquantum.core.operators.Hamiltonian
- class mindquantum.core.operators.Hamiltonian(hamiltonian, dtype=None)[source]
A QubitOperator hamiltonian wrapper.
- Parameters
hamiltonian (Union[QubitOperator, scipy.sparse]) – The pauli qubit operator or a sparse matrix.
dtype (mindquantum.dtype) – data type of hamiltonian. Default:
None
.
Examples
>>> from mindquantum.core.operators import QubitOperator, Hamiltonian >>> ham = Hamiltonian(QubitOperator('Z0 Y1', 0.3)) >>> ham 3/10 [Z0 Y1]
- astype(dtype)[source]
Convert hamiltonian to other type.
- Parameters
dtype (mindquantum.dtype) – the new type of hamiltonian.
- property dtype
Get hamiltonian data type.