qiu_quantum_computing.uniformly_controlled_rotation
¶
Uniformly controlled rotations, decomposed into elementary gates.
Functions:
-
uniformly_controlled_rotation–Return the uniformly controlled rotation with the given angles.
Attributes:
-
RotationAxis–The axes a uniformly controlled rotation can rotate about.
RotationAxis
module-attribute
¶
RotationAxis = Literal['y', 'z']
The axes a uniformly controlled rotation can rotate about.
uniformly_controlled_rotation
¶
uniformly_controlled_rotation(axis: RotationAxis, angles: ArrayLike) -> QuantumCircuit
Return the uniformly controlled rotation with the given angles.
The circuit acts on k + 1 qubits for 2**k angles: qubit 0 is the target, and
qubits 1, ..., k are the controls. For the controls in the basis state
|c>, with c = sum_j c_j 2^j over the control qubits j + 1, the target is
rotated by R_axis(angles[c]), i.e. the circuit implements the block diagonal
unitary diag(R(angles[0]), R(angles[1]), ...).
The decomposition of Möttönen et al., "Quantum circuits for general multiqubit
gates" (2004), uses 2**k rotations and 2**k CNOT gates for k >= 1, with
the rotation angles computed by a Walsh-Hadamard transform. It involves no
eigendecompositions, and is thus numerically robust for any angles.
Parameters:
-
axis(RotationAxis) –The rotation axis,
"y"or"z". -
angles(ArrayLike) –The
2**krotation angles, one per basis state of the controls.
Returns:
-
QuantumCircuit–The circuit of
ryorrzrotations andcxgates.
Raises:
-
ValueError–If the axis is not
"y"or"z", or if the angles are not a 1D array whose size is a power of 2.
Source code in packages/qiu-quantum-computing/src/qiu_quantum_computing/uniformly_controlled_rotation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |