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

DummyEngine

Extends:

BasicEngine → DummyEngine

DummyEngine used for testing. The DummyEngine forwards all commands directly to next engine. If this.is_last_engine == true it just discards all gates. By setting save_commands == true all commands get saved as a list in this.received_commands. Elements are appended to this list so they are ordered according to when they are received.

Constructor Summary

Public Constructor
public

constructor(saveCommands: boolean)

Member Summary

Public Members
public
public

Method Summary

Public Methods
public
public

receive(commandList: *)

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(saveCommands: boolean) source

Override:

BasicEngine#constructor

Params:

NameTypeAttributeDescription
saveCommands boolean

default is false

Public Members

public receivedCommands: *[] source

public saveCommands: * source

Public Methods

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 *