Skip to content

workbench_algorithms.experimental.subroutines.rotations

Subpackage for experimental rotations.

PauliToPauliBasisTransform

PauliToPauliBasisTransform(**kwargs)

Bases: Qubrick

Transforms quantum operations between different Pauli bases (X, Y, Z).

Used to simplify or standardize quantum computations.

y_to_z

y_to_z(qbits: Qubits, ctrl: Qubits | int = 0)

Convert y to z.

x_to_z

x_to_z(qbits: Qubits, ctrl: Qubits | int = 0)

Convert x to z.

pauli_product_to_z

pauli_product_to_z(
    x_qbits: Qubits, z_qbits: Qubits, ctrl: Qubits | int = 0
)

Convert PPO to z.

z_to_y

z_to_y(qbits: Qubits, ctrl: Qubits | int = 0)

Convert z to y.

z_to_x

z_to_x(qbits: Qubits, ctrl: Qubits | int = 0)

Convert z to x.

z_to_pauli_product

z_to_pauli_product(
    x_qbits: Qubits, z_qbits: Qubits, ctrl: Qubits | int = 0
)

Convert z to PPO.

RotationViaPhaseGradientAddition

RotationViaPhaseGradientAddition(
    adder_qbk: Adder | None = None, **kwargs
)

Bases: Qubrick

Coherently-applies WB qc.phase rotations via phase gradient addition.

This method originated from Appendix A in arxiv:2007.07391 (See Appendix D.1.2 in this paper for how this is used to form a multiplexor)

The PGA circuit is defined with respect to phase rotations; as such, implementing any other-axis rotation in a coherent superposition typically requires rotating to the Z basis, in-place adding with a phase gradient, and then rotating back to the original basis.

This Qubrick is a stand-in for that base-case of phase gate.

Parameters:

Name Type Description Default
adder_qbk Adder | None

Qubrick for implementing the addition in the phase gradient addition.

None
kwargs dict[str, Any]

Other key word arguments to pass to the constructor.

{}

compute

compute(
    angle_reg: Qubits,
    target_reg: Qubits,
    rot_data: MultiplexedRotationDataInterface,
    ctrl: Qubits | int = 0,
)

Compute circuit for rotations via phase gradient addition.

Parameters:

Name Type Description Default
angle_reg Qubits

Register where rotation angles have been written.

required
target_reg Qubits

Single qubit where rotations are applied.

required
rot_data MultiplexedRotationDataInterface

discretized rotation angles data for the multiplexor

required
ctrl Qubits | int

Control register.

0

RotationViaSingleQubitUnitaries

RotationViaSingleQubitUnitaries(**kwargs)

Bases: Qubrick

Compute circuit for rotations via controlled single-qubit rotations.

See Appendix D.1.1 in this paper for how this is used to form a multiplexor.

Note

Here we note some conventions used in the literature and its correspondence in this Qubrick:

  • In arXiv:1812.00954, a multiplexed Y rotation is written as \(\text{RY}(\theta_x) = e^{i2\pi \theta_x Y}\), with \(\theta_x\) in radians.
  • With an explicit factor of \(2\pi\) in the exponent, this implies the angles range from zero to one.
  • Workbench does not include this factor of \(2\pi\) in its definition of Pauli rotations, so it must be accounted for.
  • Additionally, the default units in Workbench are degrees, and thus, this is why the angle args below have a factor of 360 in the numerator.
  • This routine makes use of an integer approximation of \(\theta_x\) by truncating its binary expansion to \(b\) bits.
  • For these reasons, the integer angle approximations written to a register in this routine take values from zero to \(2^b - 1\).

compute

compute(
    angle_reg: Qubits,
    target_reg: Qubits,
    rot_data: MultiplexedRotationDataInterface,
    ctrl: Qubits | int = 0,
)

Compute circuit for rotations via controlled single qubit rotations.

Parameters:

Name Type Description Default
angle_reg Qubits

Register where rotation angles have been written.

required
target_reg Qubits

Single qubit where rotations are applied.

required
rot_data MultiplexedRotationDataInterface

discretized rotation angles data for the multiplexor

required
ctrl Qubits | int

Control register.

0