quairkit.core.state.backend.base¶
-
class quairkit.core.state.backend.base.State(sys_dim, dtype=
None
, device=None
)¶ The abstract base class for all quantum state backends in QuAIRKit.
- property dtype : dtype¶
The data type of this state
- property device : device¶
The device of this state
- property system_dim : list[int]¶
The list of dimensions for each system
- property dim : int¶
The dimension of this state
- are_qubits()¶
Whether all systems are qubits
- are_qutrits()¶
Whether all systems are qutrits
- property num_systems : int¶
The number of systems
- property num_qubits : int¶
The number of qubits of this state, when all systems are qubits
- abstract clone()¶
Return a copy of the quantum state.
- abstract measure(system_idx, shots, measure_op)¶
Measure the quantum state with the given measurement operator.
- abstract expec_val(hamiltonian, shots, decompose)¶
The expectation value of the observable with respect to the quantum state.
- Parameters:¶
- hamiltonian : Hamiltonian¶
Input observable.
- shots : int | None¶
the total number of shots to measure.
- decompose : bool¶
If decompose is
True
, it will return the expectation value of each term.
- Returns:¶
The measured expectation value (per term) of the input observable for the quantum state.
- Return type:¶
Tensor