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

ControlledGate

Extends:

BasicGate → ControlledGate

Example:


    

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

gate: *

public

n: *

Method Summary

Public Methods
public

equal(other: *): boolean

public

getInverse(): *

public

or(qubits: Array<Qureg>)

Apply the controlled gate to qubits, using the first n qubits as controls.

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(gate: BasicGate, n: number) source

Override:

BasicGate#constructor

Params:

NameTypeAttributeDescription
gate BasicGate

Gate to wrap.

n number

Number of control qubits.

Public Members

public gate: * source

public n: * source

Public Methods

public equal(other: *): boolean source

Override:

BasicGate#equal

Params:

NameTypeAttributeDescription
other *

Return:

boolean

public getInverse(): * source

Override:

BasicGate#getInverse

Return:

*

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.

Override:

BasicGate#or

Params:

NameTypeAttributeDescription
qubits Array<Qureg>

qubits to which to apply the gate.

public toString(): string source

Override:

BasicGate#toString

Return:

string