Main Content

ucryGate

Uniformly controlled y-axis rotation gate

Since R2023b

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

    Description

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

    example

    cg = ucryGate(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 y-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 = ucryGate(1,2,[pi/2 pi])
    cg = 
      CompositeGate with properties:
    
                 Name: "ucry"
        ControlQubits: [1x0 double]
         TargetQubits: [1 2]
                Gates: [4x1 quantum.gate.SimpleGate]
    
    

    Get the matrix representation of the gate.

    M = getMatrix(cg)
    M = 4×4
    
        0.7071   -0.7071         0         0
        0.7071    0.7071         0         0
             0         0    0.0000   -1.0000
             0         0    1.0000    0.0000
    
    

    Plot the returned UCRY 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: ucry.

    Create a uniformly controlled y-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 = ucryGate(1:3,4,theta)
    cg1 = 
      CompositeGate with properties:
    
                 Name: "ucry"
        ControlQubits: [1x0 double]
         TargetQubits: [1 2 3 4]
                Gates: [16x1 quantum.gate.SimpleGate]
    
    

    Plot the UCRY gate.

    plot(cg1)

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

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

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

    Plot the UCRY 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: ucry.

    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 ucryGate function removes single-qubit rotation gates that have an angle magnitude less than this rotation threshold.

    Output Arguments

    collapse all

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

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

    • If no control qubits are specified, then the ucryGate function returns cg as the RY gate (ryGate).

    More About

    collapse all

    Matrix Representation of Uniformly Controlled y-Axis Rotation Gate

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

    [cos(θ12)sin(θ12)00sin(θ12)cos(θ12)0000cos(θ22)sin(θ22)00sin(θ22)cos(θ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