Home Reference Source
import CommandModifier from 'projectq/src/cengines/cmdmodifier.js'
public class | source

CommandModifier

Extends:

BasicEngine → CommandModifier

Constructor Summary

Public Constructor
public

constructor(cmdModFunc: function)

Member Summary

Private Members
private

Method Summary

Public Methods
public

receive(cmdList: Command[])

Receive a list of commands from the previous engine, modify all commands, and send them on to the next engine.

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

Override:

BasicEngine#constructor

Params:

NameTypeAttributeDescription
cmdModFunc function

Function which, given a command cmd, returns the command it should send instead.

Example:


    

Private Members

private _cmdModFunc: * source

Public Methods

public receive(cmdList: Command[]) source

Receive a list of commands from the previous engine, modify all commands, and send them on to the next engine.

Override:

BasicEngine#receive

Params:

NameTypeAttributeDescription
cmdList Command[]

List of commands to receive and then (after modification) send on.