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

BasicRotationGate

Extends:

BasicGate → BasicRotationGate

Direct Subclass:

Rx, Ry, Rz

Defines a base class of a rotation gate.

A rotation gate has a continuous parameter (the angle), labeled 'angle' / this.angle. Its inverse is the same gate with the negated argument. Rotation gates of the same class can be merged by adding the angles. The continuous parameter is modulo 4 pi, this.angle is in the interval [0, 4 pi).

Constructor Summary

Public Constructor
public

constructor(angle: *)

Member Summary

Public Members
public

angle: *

Method Summary

Public Methods
public

equal(other: *): boolean

public
public

Return self merged with another gate.

public

Return the Latex string representation of a BasicRotationGate.

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(angle: *) source

Override:

BasicGate#constructor

Params:

NameTypeAttributeDescription
angle *

{number} Angle of rotation (saved modulo 4 * pi)

Public Members

public angle: * source

Public Methods

public equal(other: *): boolean source

Override:

BasicGate#equal

Params:

NameTypeAttributeDescription
other *

Return:

boolean

public getInverse(): BasicRotationGate source

Override:

BasicGate#getInverse

Return:

BasicRotationGate

Return the inverse of this rotation gate (negate the angle, return new object).

public getMerged(other: BasicRotationGate | Object): BasicRotationGate source

Return self merged with another gate.

Default implementation handles rotation gate of the same type, where angles are simply added.

Override:

BasicGate#getMerged

Params:

NameTypeAttributeDescription
other BasicRotationGate | Object

Return:

BasicRotationGate

New object representing the merged gates.

Throw:

NotMergeable

For non-rotation gates or rotation gates of different type.

public texString(): string source

Return the Latex string representation of a BasicRotationGate.

Returns the class name and the angle as a subscript, i.e.

Return:

string

Example:

[CLASSNAME]$_[ANGLE]$

public toString(): string source

Override:

BasicGate#toString

Return:

string