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

BasicPhaseGate

Extends:

BasicGate → BasicPhaseGate

Direct Subclass:

Ph, R

Defines a base class of a phase gate.

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

Constructor Summary

Public Constructor
public

Initialize a basic rotation gate.

Member Summary

Public Members
public

angle: *

Method Summary

Public Methods
public

equal(other: *): boolean

public

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

public

Return self merged with another gate.

public
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: number) source

Initialize a basic rotation gate.

Override:

BasicGate#constructor

Params:

NameTypeAttributeDescription
angle number

Angle of rotation (saved modulo 2 * pi)

Public Members

public angle: * source

Public Methods

public equal(other: *): boolean source

Override:

BasicGate#equal

Params:

NameTypeAttributeDescription
other *

Return:

boolean

public getInverse(): BasicPhaseGate source

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

Override:

BasicGate#getInverse

Return:

BasicPhaseGate

public getMerged(other: BasicPhaseGate): BasicPhaseGate 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 BasicPhaseGate

Phase gate of same type.

Return:

BasicPhaseGate

New object representing the merged gates.

Throw:

*

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

public texString(): string source

Return:

string

public toString(): string source

Override:

BasicGate#toString

Return:

string