Main Content

ucrxGate

Uniformly controlled x-axis rotation gate

Since R2023b

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

    Description

    example

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

    example

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

    Examples

    collapse all

    Create a uniformly controlled x-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 = ucrxGate(1,2,[pi/2 pi])
    cg = 
      CompositeGate with properties:
    
                 Name: "ucrx"
        ControlQubits: [1×0 double]
         TargetQubits: [1 2]
                Gates: [4×1 quantum.gate.SimpleGate]
    
    

    Get the matrix representation of the gate.

    M = getMatrix(cg)
    M = 4×4 complex
    
       0.7071 + 0.0000i   0.0000 - 0.7071i   0.0000 + 0.0000i   0.0000 + 0.0000i
       0.0000 - 0.7071i   0.7071 + 0.0000i   0.0000 + 0.0000i   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 - 1.0000i   0.0000 + 0.0000i
    
    

    Plot the returned UCRX gate to show its internal gates.

    plot(cg)

    Create a uniformly controlled x-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 = ucrxGate(1:3,4,theta)
    cg1 = 
      CompositeGate with properties:
    
                 Name: "ucrx"
        ControlQubits: [1×0 double]
         TargetQubits: [1 2 3 4]
                Gates: [16×1 quantum.gate.SimpleGate]
    
    

    Plot the UCRX gate.

    plot(cg1)

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

    cg2 = ucrxGate(1:3,4,theta,RotationThreshold=0.1)
    cg2 = 
      CompositeGate with properties:
    
                 Name: "ucrx"
        ControlQubits: [1×0 double]
         TargetQubits: [1 2 3 4]
                Gates: [9×1 quantum.gate.SimpleGate]
    
    

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

    plot(cg2)

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

    Output Arguments

    collapse all

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

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

    • If no control qubits are specified, then the ucrxGate function returns cg as the RX gate (rxGate).

    More About

    collapse all

    Matrix Representation of Uniformly Controlled x-Axis Rotation Gate

    The matrix representation of a uniformly controlled x-axis rotation gate has a block diagonal structure made from the 2-by-2 RX gate matrices of the input rotation angles. For example, when the UCRX 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)isin(θ12)00isin(θ12)cos(θ12)0000cos(θ22)isin(θ22)00isin(θ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