Miscellaneous Operations

Various standard operations on quantum states, which aren’t gates, channels, circuits, or DAGCircuit’s.

class quantumflow.Moment(*elements: Operation, qubits: Sequence[Qubit] | None = None)

Represents a collection of Operations that operate on disjoint qubits, so that they may be applied at the same moment of time.

class quantumflow.Measure(qubit: Qubit, cbit: Hashable | None = None)

Measure a quantum bit and copy result to a classical bit

class quantumflow.Reset(*qubits: Qubit)

An operation that resets qubits to zero irrespective of the initial state.

class quantumflow.Initialize(ket: State)

An operation that initializes the quantum state

class quantumflow.Barrier(*qubits: Qubit)

An operation that prevents reordering of operations across the barrier. Has no effect on the quantum state.

class quantumflow.Store(key: Hashable, value: Any, qubits: Sequence[Qubit] = ())

Store a value in the classical memory of the state.

class quantumflow.If(elem: Operation, key: Hashable, value: bool = True)

Look up key in classical memory, and apply the given quantum operation only if the truth value matches.

class quantumflow.Display(key: Hashable, action: Callable, qubits: Sequence[Qubit] = ())

A Display is an operation that extracts information from the quantum state and stores it in classical memory, without performing any effect on the qubits.

class quantumflow.StateDisplay(key: Hashable, qubits: Sequence[Qubit] = ())

Store a copy of the state in the classical memory. (This operation can be memory intensive, since it stores the entire quantum state.)

class quantumflow.ProbabilityDisplay(key: Hashable, qubits: Sequence[Qubit] = ())

Store the state probabilities in classical memory.

class quantumflow.DensityDisplay(key: Hashable, qubits: Sequence[Qubit])

Store the density matrix of given qubits in classical memory.

class quantumflow.Projection(states: Sequence[State])

A projection operator, represented as a sequence of state vectors