quri_parts.core.state.state_vector module#

StateVectorType: TypeAlias = 'npt.NDArray[np.complex128]'#

A type alias representing a numerical state vector, equivalent to np.ndarray of complex floats.

class QuantumStateVectorMixin(n_qubits, vector=None)#

Bases: ABC

Parameters:
  • n_qubits (int) –

  • vector (Optional[Union[StateVectorType, 'npt.ArrayLike']]) –

property vector: core.state.state_vector.StateVectorType#
class QuantumStateVector(n_qubits, vector=None, circuit=None)#

Bases: QuantumStateVectorMixin, CircuitQuantumStateMixin, QuantumState

QuantumStateVector represents a state defined by a state vector with an optional circuit to be applied.

Parameters:
  • n_qubits (int) –

  • vector (Optional[Union[StateVectorType, 'npt.ArrayLike']]) –

  • circuit (Optional[NonParametricQuantumCircuit]) –

property qubit_count: int#

Returns the qubit count of the state.

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:

QuantumStateVector