Skip to content

qiu_quantum_computing.preparable_state

A quantum state together with the way it is prepared in a circuit.

Classes:

  • PreparableState –

    An immutable quantum state, preparable from the all-zero state by a circuit.

PreparableState dataclass

PreparableState(statevector: Statevector | ArrayLike, method: SynthesisMethod = GATE)

An immutable quantum state, preparable from the all-zero state by a circuit.

The preparation circuits are built on first access and cached. Since the state and the method cannot change, the cached circuits always prepare the state.

Parameters:

  • statevector (Statevector | ArrayLike) –

    The normalized state, as a Qiskit statevector or its amplitudes. It is copied.

  • method (SynthesisMethod, default: GATE ) –

    How the preparation is represented in the circuits, see state_preparation_circuit.

Attributes:

Source code in packages/qiu-quantum-computing/src/qiu_quantum_computing/preparable_state.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def __init__(
    self,
    statevector: Statevector | npt.ArrayLike,
    method: SynthesisMethod = SynthesisMethod.GATE,
) -> None:
    """Initialize the preparable state.

    Args:
        statevector: The normalized state, as a Qiskit statevector or its
            amplitudes. It is copied.
        method: How the preparation is represented in the circuits, see
            `state_preparation_circuit`.
    """
    object.__setattr__(self, "statevector", validated_statevector(statevector))
    object.__setattr__(self, "method", SynthesisMethod(method))

statevector instance-attribute

statevector: Statevector

The normalized state. Given amplitudes are converted to a statevector.

method class-attribute instance-attribute

How the preparation is represented in the circuits.

num_qubits property

num_qubits: int

The number of qubits of the state.

circuit cached property

circuit: QuantumCircuit

The circuit mapping the all-zero state to the state.

inverse_circuit cached property

inverse_circuit: QuantumCircuit

The circuit mapping the state to the all-zero state.