quairkit.core.hamiltonian¶
The module of the hamiltonian class.
-
class quairkit.core.hamiltonian.Hamiltonian(pauli_str, compress=
True
)¶ Hamiltonian
class
in QuAIRKit.User can instantiate the
class
with a Pauli string.Note
If
compress=False
, the legitimacy of the input will not be checked.- property n_terms : int¶
Number of terms of the hamiltonian.
- property pauli_str : list¶
The Pauli string corresponding to the hamiltonian.
- property terms : Iterable[float]¶
All items in hamiltonian, i.e.
[['Z0, Z1'], ['I']]
.
- property coefficients : list[float]¶
The coefficient of each term in the Hamiltonian, i.e.
[1.0, 2.0]
.
- property pauli_words : list[str]¶
The Pauli word of each term, i.e.
['ZIZ', 'IIX']
.
- property pauli_words_r : list[str]¶
A list of Pauli word (exclude I), i.e.
['ZXZZ', 'Z', 'X']
.
- property pauli_words_matrix : list[Tensor]¶
The list of matrices with respect to simplied Pauli words.
- property matrix : Tensor¶
The matrix form of the Hamiltonian.
- property sites : list¶
A list of qubits index corresponding to the hamiltonian.
- property n_qubits : int¶
Number of qubits.
- decompose_with_sites()¶
Decompose pauli_str into coefficients, a simplified form of Pauli strings, and the indices of qubits on which the Pauli operators act on.
- Returns:¶
coefficients: the coefficient for each term.
pauli_words_r: the simplified form of the Pauli string for each item, e.g. the Pauli word of ‘Z0, Z1, X3’ is ‘ZZX’.
sites: a list of qubits index, e.g. the site of ‘Z0, Z1, X3’ is [0, 1, 3].
- Return type:¶
A tuple containing the following elements
- decompose_pauli_words()¶
Decompose pauli_str into coefficients and Pauli strings.
-
class quairkit.core.hamiltonian.SpinOps(size, use_sparse=
False
)¶ The spin operators in matrix forms, could be used to construct Hamiltonian matrix or spin observables.
- Parameters:¶
- property sigz_p : list¶
A list of \(S^z_i\) operators, different elements correspond to different indices \(i\).
- property sigy_p : list¶
A list of \(S^y_i\) operators, different elements correspond to different indices \(i\).
- property sigx_p : list¶
A list of \(S^x_i\) operators, different elements correspond to different indices \(i\).