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

DaggeredGate

Extends:

BasicGate → DaggeredGate

Wrapper class allowing to execute the inverse of a gate, even when it does not define one.

If there is a replacement available, then there is also one for the inverse, namely the replacement function run in reverse, while inverting all gates. This class enables using this emulation automatically.

A DaggeredGate is returned automatically when employing the getInverse- function on a gate which does not provide a getInverse() member function.

Example:


with Dagger(eng)
MySpecialGate | qubits

will create a DaggeredGate if MySpecialGate does not implement
getInverse. If there is a decomposition function available, an auto-
replacer engine can automatically replace the inverted gate by a call to
the decomposition function inside a "with Dagger"-statement.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

gate: *

public get

matrix: *

Private Members
private

_matrix: *

Method Summary

Public Methods
public

equal(other: *): *

Return true if self is equal to other, i.e., same type and representing the inverse of the same gate.

public

getInverse(): *

public
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) source

Override:

BasicGate#constructor

Params:

NameTypeAttributeDescription
gate BasicGate

Any gate object of which to represent the inverse.

Public Members

public gate: * source

public get matrix: * source

Private Members

private _matrix: * source

Public Methods

public equal(other: *): * source

Return true if self is equal to other, i.e., same type and representing the inverse of the same gate.

Override:

BasicGate#equal

Params:

NameTypeAttributeDescription
other *

Return:

*

public getInverse(): * source

Override:

BasicGate#getInverse

Return:

*

public texString(): string source

Return:

string

public toString(): string source

Override:

BasicGate#toString

Return:

string