qib.algorithms.qubitization.projector_controlled_phase_shift.ProjectorControlledPhaseShift

class qib.algorithms.qubitization.projector_controlled_phase_shift.ProjectorControlledPhaseShift(theta: float = 0, projection_state: Sequence[int] = [0], encoding_qubits: Qubit | Sequence[Qubit] | None = None, auxiliary_qubits: Qubit | Sequence[Qubit] | None = None, method='auxiliary')[source]

Bases: object

Projector-controlled phase shift circuit. Building block for Qubitization. 2 possible methods: “auxiliary” or “c-phase”. Projector is state |0>, |00>… on the encoding (auxiliary) qubitS.

Methods

as_circuit

Generates the circuit.

as_matrix

Generate the matrix representation of the controlled gate.

set_auxiliary_qubits

Set the auxiliary qubits.

set_encoding_qubits

Set the encoding qubits.

set_method

Set the method.

set_projection_state

Set the projection state.

set_theta

Set the angle theta.

Attributes

num_wires

The number of "wires" (or quantum particles) this gate acts on.

as_circuit()[source]

Generates the circuit. * with ‘auxiliary’ method I have an extra wire. * In order to compare it to as_matrix() you need to compare only the half upper-left block.

as_matrix()[source]

Generate the matrix representation of the controlled gate. The extra wire from ‘auxiliary’ method is not taken into account.

property num_wires

The number of “wires” (or quantum particles) this gate acts on. One extra wire with method ‘auxiliary’.

set_auxiliary_qubits(*args)[source]

Set the auxiliary qubits. Only works if the method is set to auxiliary.

set_encoding_qubits(*args)[source]

Set the encoding qubits.

set_method(method='auxiliary')[source]

Set the method. If method == ‘auxiliary’ the auxiliary qubits’ list gets erased.

set_projection_state(projection_state: Sequence[int] = [1, 0])[source]

Set the projection state.

set_theta(theta)[source]

Set the angle theta.