BasicPhaseGate
Extends:
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 |
constructor(angle: number) Initialize a basic rotation gate. |
Member Summary
Public Members | ||
public |
angle: * |
Method Summary
Public Methods | ||
public |
|
|
public |
Return the inverse of this rotation gate (negate the angle, return new object). |
|
public |
getMerged(other: BasicPhaseGate): BasicPhaseGate Return self merged with another gate. |
|
public |
|
|
public |
|
Inherited Summary
From class BasicGate | ||
public static |
Convert quantum input of "gate | quantum input" to internal formatting. |
|
public |
|
|
public |
|
|
public |
|
|
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 |
toString() |
Public Constructors
public constructor(angle: number) source
Initialize a basic rotation gate.
Override:
BasicGate#constructorParams:
Name | Type | Attribute | Description |
angle | number | Angle of rotation (saved modulo 2 * pi) |
Public Members
public angle: * source
Public Methods
public equal(other: *): boolean source
Override:
BasicGate#equalParams:
Name | Type | Attribute | Description |
other | * |
public getInverse(): BasicPhaseGate source
Return the inverse of this rotation gate (negate the angle, return new object).
Override:
BasicGate#getInversepublic 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#getMergedParams:
Name | Type | Attribute | Description |
other | BasicPhaseGate | Phase gate of same type. |
Throw:
* |
NotMergeable For non-rotation gates or rotation gates of different type. |