z-axis rotation gate with global phase
Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
applies an R1 gate (z-axis rotation gate with global phase) to a single
target qubit and returns a
g = r1Gate(
quantum.gate.SimpleGate object. This gate changes the phase of the state by an angle of
thetaare vectors of qubit indices and angles with the same length,
r1Gatereturns a column vector of gates, where
g(i)represents a z-axis rotation gate with global phase applied to a qubit with index
targetQubit(i)with a rotation angle of
thetais a scalar, and the other input is a vector, then MATLAB® expands the scalar to match the size of the vector input.
R1 Gate and Its Matrix Representation
Create an R1 gate that acts on a single qubit with rotation angle
g = r1Gate(1,pi/2)
g = SimpleGate with properties: Type: "r1" ControlQubits: [1×0 double] TargetQubits: 1 Angles: 1.5708
Get the matrix representation of the gate.
M = getMatrix(g)
M = 1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 1.0000i
Array of R1 Gates
Create an array of three R1 gates. The first gate acts on qubit 1
with rotation angle
pi/4, the next gate acts on qubit 2 with rotation
pi/2, and the final gate acts on qubit 3 with rotation angle
g = r1Gate(1:3,pi/4*(1:3))
g = 3×1 SimpleGate array with gates: Id Gate Control Target Angle 1 r1 1 pi/4 2 r1 2 pi/2 3 r1 3 3pi/4
targetQubit — Target qubit of gate
positive integer scalar | positive integer vector
Target qubit of the gate, specified as a positive integer scalar index or vector of qubit indices.
theta — Rotation angle
real scalar | real vector
Rotation angle, specified as a real scalar or vector.
Matrix Representation of R1 Gate
The matrix representation of an R1 gate applied to a target qubit with a rotation angle of is
This gate changes the phase of the state by angle of and leave the state as is. Applying this gate with rotation angle is equivalent to applying a Pauli Z gate
This gate is also equivalent to the z-axis rotation gate
rzGate) with a global phase difference.
Introduced in R2023a