Home Reference Source
import {UniformlyControlledRz} from 'projectq/src/ops/uniformly_controlled_rotation.js'
public class | source

UniformlyControlledRz

Extends:

BasicGate → UniformlyControlledRz

Uniformly controlled Rz gate as introduced in arXiv:quant-ph/0312218.

This is an n-qubit gate. There are n-1 control qubits and one target qubit. This gate applies Rz(angles(k)) to the target qubit if the n-1 control qubits are in the classical state k. As there are 2^(n-1) classical states for the control qubits, this gate requires 2^(n-1) (potentially different) angle parameters.

Example: .. code-block:: python

controls = eng.allocate_qureg(2) target = eng.allocate_qubit() UniformlyControlledRz(angles=[0.1, 0.2, 0.3, 0.4]) | (controls, target)

Note: The first quantum register are the contains qubits. When converting the classical state k of the control qubits to an integer, we define controls[0] to be the least significant (qu)bit. controls can also be an empty list in which case the gate corresponds to an Rz.

Args: angles(list[float]): Rotation angles. Rz(angles[k]) is applied conditioned on the control qubits being in state k.

Constructor Summary

Public Constructor
public

constructor(angles: number[])

Member Summary

Public Members
public

angles: *

Method Summary

Public Methods
public

equal(other: *): boolean

public

getInverse(): *

public

getMerged(other: *): *

public

Inherited Summary

From class BasicGate
public static

makeTupleOfQureg(qubits: Qubit | Qubit[] | Qureg | Qureg[]): Qureg[]

Convert quantum input of "gate | quantum input" to internal formatting.

public
public
public

equal(other: BasicGate | Object): boolean

public

generateCommand(qubits: *): Command

Helper function to generate a command consisting of the gate and the qubits being acted upon.

public
public
public
public

or(qubits: *)

Operator| overload which enables the syntax Gate | qubits.

public

Public Constructors

public constructor(angles: number[]) source

Override:

BasicGate#constructor

Params:

NameTypeAttributeDescription
angles number[]

Public Members

public angles: * source

Public Methods

public equal(other: *): boolean source

Override:

BasicGate#equal

Params:

NameTypeAttributeDescription
other *

Return:

boolean

public getInverse(): * source

Override:

BasicGate#getInverse

Return:

*

public getMerged(other: *): * source

Override:

BasicGate#getMerged

Params:

NameTypeAttributeDescription
other *

Return:

*

public toString(): string source

Override:

BasicGate#toString

Return:

string