BasicGate
Direct Subclass:
Indirect Subclass:
Base class of all gates.
Static Method Summary
Static Public Methods | ||
public static |
Convert quantum input of "gate | quantum input" to internal formatting. |
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
|
Method Summary
Public Methods | ||
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() |
Static Public Methods
public static makeTupleOfQureg(qubits: Qubit | Qubit[] | Qureg | Qureg[]): Qureg[] source
Convert quantum input of "gate | quantum input" to internal formatting.
A Command object only accepts tuples of Quregs (list of Qubit objects) as qubits input parameter. However, with this function we allow the user to use a more flexible syntax:
1) Gate | qubit 2) Gate | [qubit0, qubit1] 3) Gate | qureg 4) Gate | (qubit, ) 5) Gate | (qureg, qubit)
where qubit is a Qubit object and qureg is a Qureg object. This function takes the right hand side of | and transforms it to the correct input parameter of a Command object which is:
1) -> Gate | ([qubit], ) 2) -> Gate | ([qubit0, qubit1], ) 3) -> Gate | (qureg, ) 4) -> Gate | ([qubit], ) 5) -> Gate | (qureg, [qubit])
Public Constructors
public constructor() source
Example:
ExampleGate | (a,b,c,d,e)
where a and b are interchangeable. Then, call this function as
follows:
this.set_interchangeable_qubit_indices([[0,1]])
As another example, consider
ExampleGate2 | (a,b,c,d,e)
where a and b are interchangeable and, in addition, c, d, and e
are interchangeable among themselves. Then, call this function as
this.set_interchangeable_qubit_indices([[0,1],[2,3,4]])
Public Members
public interchangeableQubitIndices: *[] source
Public Methods
public equal(other: BasicGate | Object): boolean source
Params:
Name | Type | Attribute | Description |
other | BasicGate | Object |
public generateCommand(qubits: *): Command source
Helper function to generate a command consisting of the gate and the qubits being acted upon.
Params:
Name | Type | Attribute | Description |
qubits | * | {Qubit | Array.<Qubit> | Qureg} see BasicGate.makeTupleOfQureg(qubits) |
public or(qubits: *) source
Operator| overload which enables the syntax Gate | qubits.
Params:
Name | Type | Attribute | Description |
qubits | * | {Qubit | Array.<Qubit> | Qureg} a Qubit object, a list of Qubit objects, a Qureg object, or a tuple of Qubit or Qureg objects (can be mixed). |
Example:
1) Gate | qubit
2) Gate | [qubit0, qubit1]
3) Gate | qureg
4) Gate | (qubit, )
5) Gate | (qureg, qubit)