quri_parts.core.state.state module#

class QuantumState(*args, **kwargs)#

Bases: Protocol

QuantumState is an interface for classes representing a quantum state.

Since this interface is defined with Protocol, explicit inheritance of this class is not necessary when implementing a concrete class with this interface. (You can inherit it to indicate the interface if you want.)

abstract property qubit_count: int#

Returns the qubit count of the state.

class CircuitQuantumState(*args, **kwargs)#

Bases: QuantumState

CircuitQuantumState is an interface for classes representing a quantum state generated by applying a circuit to |00…0> state.

abstract property circuit: ImmutableQuantumCircuit#

Circuit to build the quantum state.

abstract 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:

CircuitQuantumState

class CircuitQuantumStateMixin(n_qubits, circuit=None)#

Bases: ABC

Parameters:
property circuit: ImmutableQuantumCircuit#

Circuit to build the quantum state.

class GeneralCircuitQuantumState(n_qubits, circuit=None)#

Bases: CircuitQuantumStateMixin, CircuitQuantumState

GeneralCircuitQuantumState represents a state given as a result of applying a circuit to |00…0> state.

Parameters:
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:

GeneralCircuitQuantumState