Main Content

ucrzGate

Uniformly controlled z-axis rotation gate

Since R2023b

    Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.

    Description

    cg = ucrzGate(controlQubits,targetQubit,theta) applies a z-axis rotation gate of angle theta to a single target qubit for each computational basis state of the control qubits.

    example

    cg = ucrzGate(controlQubits,targetQubit,theta,RotationThreshold=thresh) also removes single-qubit rotation gates that have an angle magnitude less than the rotation threshold.

    example

    Examples

    collapse all

    Create a uniformly controlled z-axis rotation gate that acts on a control qubit with index 1 and a target qubit with index 2 using rotation angles pi/2 and pi.

    cg = ucrzGate(1,2,[pi/2 pi])
    cg = 
      CompositeGate with properties:
    
                 Name: "ucrz"
        ControlQubits: [1x0 double]
         TargetQubits: [1 2]
                Gates: [4x1 quantum.gate.SimpleGate]
    
    

    Get the matrix representation of the gate.

    M = getMatrix(cg)
    M = 4×4 complex
    
       0.7071 - 0.7071i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
       0.0000 + 0.0000i   0.7071 + 0.7071i   0.0000 + 0.0000i   0.0000 + 0.0000i
       0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 - 1.0000i   0.0000 + 0.0000i
       0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 1.0000i
    
    

    Plot the returned UCRZ gate to show its internal gates.

    plot(cg)

    Figure contains an object of type quantum.gate.quantumcircuitchart. The chart of type quantum.gate.quantumcircuitchart has title CompositeGate: ucrz.

    Create a uniformly controlled z-axis rotation gate that acts on three control qubits with indices 1, 2, and 3 and a target qubit with index 4 using eight rotation angles.

    theta = rand(8,1);
    cg1 = ucrzGate(1:3,4,theta)
    cg1 = 
      CompositeGate with properties:
    
                 Name: "ucrz"
        ControlQubits: [1x0 double]
         TargetQubits: [1 2 3 4]
                Gates: [16x1 quantum.gate.SimpleGate]
    
    

    Plot the UCRZ gate.

    plot(cg1)

    Figure contains an object of type quantum.gate.quantumcircuitchart. The chart of type quantum.gate.quantumcircuitchart has title CompositeGate: ucrz.

    Now create the same gate, but specify a rotation threshold of 0.1.

    cg2 = ucrzGate(1:3,4,theta,RotationThreshold=0.1)
    cg2 = 
      CompositeGate with properties:
    
                 Name: "ucrz"
        ControlQubits: [1x0 double]
         TargetQubits: [1 2 3 4]
                Gates: [10x1 quantum.gate.SimpleGate]
    
    

    Plot the UCRZ gate. The specified rotation threshold removes multiple gates from the final composite gate.

    plot(cg2)

    Figure contains an object of type quantum.gate.quantumcircuitchart. The chart of type quantum.gate.quantumcircuitchart has title CompositeGate: ucrz.

    Input Arguments

    collapse all

    Control qubits of the gate, specified as a positive integer scalar index or vector of qubit indices.

    Example: 2

    Example: 6:8

    Target qubit of the gate, specified as a positive integer scalar index.

    Example: 1

    Rotation angles, specified as a real scalar if the number of control qubits is 0 or real vector of length 2n, where n is the number of control qubits.

    Example: pi

    Example: (1:4)*pi/2

    Rotation threshold, specified as one of these values:

    • positive real number

    • "auto" — Set the threshold to the default value of 2*pi*eps.

    • "none" — Do not remove gates.

    The ucrzGate function removes single-qubit rotation gates that have an angle magnitude less than this rotation threshold.

    Output Arguments

    collapse all

    UCRZ gate, returned as a CompositeGate object or a SimpleGate object.

    • If the number of control qubits is greater than 0, then the ucrzGate function returns cg as a CompositeGate object that consists of several internal gates.

    • If no control qubits are specified, then the ucrzGate function returns cg as the RZ gate (rzGate).

    More About

    collapse all

    Matrix Representation of Uniformly Controlled z-Axis Rotation Gate

    The matrix representation of a uniformly controlled z-axis rotation gate has a block diagonal structure made from the 2-by-2 RZ gate matrices of the input rotation angles. For example, when the UCRZ gate is applied to control qubit 1 and target qubit 2 with a rotation angle vector of [θ1θ2], the matrix representation is

    [exp(iθ12)0000exp(iθ12)0000exp(iθ22)0000exp(iθ22)].

    References

    [1] Möttönen, Mikko, Juha J. Vartiainen, Ville Bergholm, and Martti M. Salomaa. "Quantum Circuits for General Multiqubit Gates." Physical Review Letters 93, no. 13 (September 20, 2004): 130502. https://doi.org/10.1103/PhysRevLett.93.130502.

    [2] Camps, Daan, and Roel Van Beeumen. "FABLE: Fast Approximate Quantum Circuits for Block-Encodings." In 2022 IEEE International Conference on Quantum Computing and Engineering (QCE), 104–113. Broomfield, CO, USA: IEEE, 2022. https://doi.org/10.1109/QCE53715.2022.00029.

    Version History

    Introduced in R2023b