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

BasicMathGate

Extends:

BasicGate → BasicMathGate

Direct Subclass:

AddConstant, AddConstantModN, MultiplyByConstantModN, src/backends/simulators/simulator.spec.js~Plus2Gate, SwapGate

Constructor Summary

Public Constructor
public

constructor(mathFunc: function)

Member Summary

Public Members
public

Method Summary

Public Methods
public

Return the math function which corresponds to the action of this math gate, given the input to the gate (a tuple of quantum registers).

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(mathFunc: function) source

Override:

BasicGate#constructor

Params:

NameTypeAttributeDescription
mathFunc function

Function which takes as many int values as input, as the gate takes registers. For each of these values, it then returns the output (i.e., it returns a list/tuple of output values).

Example:


    

    

Public Members

public mathFunc: * source

Public Methods

public getMathFunction(qubits: Array<Qureg>): function source

Return the math function which corresponds to the action of this math gate, given the input to the gate (a tuple of quantum registers).

Params:

NameTypeAttributeDescription
qubits Array<Qureg>

Qubits to which the math gate is being applied.

Return:

function

javascript function describing the action of this gate. (See BasicMathGate.constructor for an example).

public toString(): string source

Override:

BasicGate#toString

Return:

string