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

InstructionFilter

Extends:

BasicEngine → InstructionFilter

Constructor Summary

Public Constructor
public

constructor(filterFunc:: function)

Member Summary

Private Members
private

Method Summary

Public Methods
public

isAvailable(cmd: Command): *

Specialized implementation of BasicBackend.isAvailable: Forwards this call to the filter function given to the constructor.

public

receive(commandList: Command[])

Forward all commands 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(filterFunc:: function) source

Override:

BasicEngine#constructor

Params:

NameTypeAttributeDescription
filterFunc: function

Filter function which returns true for available commands, and false otherwise. filterfun will be called as filterfun(self, cmd).

Private Members

private _filterFunc: * source

Public Methods

public isAvailable(cmd: Command): * source

Specialized implementation of BasicBackend.isAvailable: Forwards this call to the filter function given to the constructor.

Override:

BasicEngine#isAvailable

Params:

NameTypeAttributeDescription
cmd Command

Command for which to check availability.

Return:

*

public receive(commandList: Command[]) source

Forward all commands to the next engine.

Override:

BasicEngine#receive

Params:

NameTypeAttributeDescription
commandList Command[]

List of commands to receive.