Home Reference Source
import {CompareEngine} from 'projectq/src/cengines/testengine.js'
public class | source

CompareEngine

Extends:

BasicEngine → CompareEngine

CompareEngine is an engine which saves all commands. It is only intended for testing purposes. Two CompareEngine backends can be compared and return true if they contain the same commmands.

Constructor Summary

Public Constructor
public

Member Summary

Private Members
private

Method Summary

Public Methods
public
public

compareCMDs(c1: *, c2: *): boolean

test if c1 & c2 are equal

public

equal(engine: *): boolean

public
public

receive(commandList: *)

public

string description

Inherited Summary

From class BasicEngine
public
public

Return a new qubit as a list containing 1 qubit object (quantum register of size 1).

public

Allocate n qubits and return them as a quantum register, which is a list of qubit objects.

public

Deallocate a qubit (and sends the deallocation command down the pipeline).

public

Default implementation of isAvailable: Ask the next engine whether a command is available, i.e., whether it can be executed by the next engine(s).

public

Check if there is a compiler engine handling the meta tag

public
public

send(commandList: Command[])

Forward the list of commands to the next engine in the pipeline.

Public Constructors

public constructor() source

Override:

BasicEngine#constructor

Private Members

private _l: undefined[] source

Public Methods

public cacheCMD(cmd: Command) source

Params:

NameTypeAttributeDescription
cmd Command

public compareCMDs(c1: *, c2: *): boolean source

test if c1 & c2 are equal

Params:

NameTypeAttributeDescription
c1 *

{Command}

c2 *

{Command}

Return:

boolean

public equal(engine: *): boolean source

Params:

NameTypeAttributeDescription
engine *

Return:

boolean

public isAvailable(): boolean source

Default implementation of isAvailable: Ask the next engine whether a command is available, i.e., whether it can be executed by the next engine(s).

Override:

BasicEngine#isAvailable

Return:

boolean

public receive(commandList: *) source

Override:

BasicEngine#receive

Params:

NameTypeAttributeDescription
commandList *

public toString(): string source

string description

Return:

string