quri_parts.core.state.comp_basis module#
- class ComputationalBasisState(n_qubits, *, bits=0)#
Bases:
CircuitQuantumState
ComputationalBasisState represents a computational basis state. A computational basis state can also be considered as a state given as a result of applying Pauli gates to |00…0> state. It internally holds a phase factor resulted from the applications of Pauli gates.
- Parameters:
n_qubits (int) – The number of qubits.
bits (int) – An integer representing a bit string of the computational basis state.
- property qubit_count: int#
Returns the qubit count of the state.
- property circuit: ImmutableQuantumCircuit#
Circuit to build the quantum state.
- with_pauli_gate_applied(gate)#
Apply a Pauli gate to the quantum state.
- Parameters:
gate (QuantumGate) –
- Return type:
- with_gates_applied(gates)#
Returns a new state with the gates applied.
The original state is not changed.
- Parameters:
gates (circuit.circuit.GateSequence) –
- Return type:
- property bits: int#
An integer representing a bit string of the computational basis state.
- property phase: float#
The phase of the state.
- comp_basis_superposition(state_a, state_b, theta, phi)#
Return a superposition state (as GeneralCircuitQuantumState) composed of two ComputationalBasisState.
\[\cos \theta | state_a \rangle + e^{i \phi} \sin \theta | state_b \rangle\]Raises ValueError if the qubit counts of the two states are different.
- Parameters:
state_a (ComputationalBasisState) –
state_b (ComputationalBasisState) –
theta (float) –
phi (float) –
- Return type: