Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
targetQubit is a vector of qubit indices,
returns a column vector of gates, where
g(i) represents an S gate applied
to a qubit with index
Applying this gate is equivalent to applying an R1 gate with a rotation angle of π/2,
sGate(targetQubit) is equivalent to
S Gate and Its Matrix Representation
Create an S gate that acts on a single qubit.
g = sGate(1)
g = SimpleGate with properties: Type: "s" ControlQubits: [1×0 double] TargetQubits: 1 Angles: [1×0 double]
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 S Gates
Create an array of S gates that act on qubits with indices 1 to 4.
g = sGate(1:4)
g = 4×1 SimpleGate array with gates: Id Gate Control Target 1 s 1 2 s 2 3 s 3 4 s 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.
Matrix Representation of S Gate
The matrix representation of an S gate applied to a single qubit is
Applying this gate is equivalent to applying an R1 gate with a rotation angle of π/2. This gate is also known as the square root of Pauli Z gate because applying the S gate twice is equivalent to applying the Pauli Z gate.
Introduced in R2023a