ControlledGate
Extends:
Controlled version of a gate.
Note:
Use the meta function :func:C() to create a controlled gate
A wrapper class which enables (multi-) controlled gates. It overloads the or-operator, using the first qubits provided as control qubits. The n control-qubits need to be the first n qubits. They can be in separate quregs.
Example:
ControlledGate(gate, 2) | (qb0, qb2, qb3) # qb0 & qb2 are controls
C(gate, 2) | (qb0, qb2, qb3) # This is much nicer.
C(gate, 2) | ([qb0,qb2], qb3) # Is equivalent
Note:
Use :func:`C` rather than ControlledGate, i.e.,
    
C(X, 2) == Toffoli
    Constructor Summary
| Public Constructor | ||
| public | 
       constructor(gate: BasicGate, n: number)  | 
    |
Method Summary
| Public Methods | ||
| public | 
      
       | 
    |
| public | 
       getInverse(): *  | 
    |
| public | 
      
       Apply the controlled gate to qubits, using the first n qubits as controls.  | 
    |
| 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 Methods
public equal(other: *): boolean source
Override:
BasicGate#equalParams:
| Name | Type | Attribute | Description | 
| other | * | 
public or(qubits: Array<Qureg>) source
Apply the controlled gate to qubits, using the first n qubits as controls.
Note: The control qubits can be split across the first quregs. However, the n-th control qubit needs to be the last qubit in a qureg. The following quregs belong to the gate.