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

TagRemover

Extends:

BasicEngine → TagRemover

is a compiler engine which removes temporary command tags (see the tag classes such as LoopTag in loop).

Removing tags is important (after having handled them if necessary) in order to enable optimizations across meta-function boundaries (compute/ action/uncompute or loops after unrolling)

Constructor Summary

Public Constructor
public

Member Summary

Private Members
private

_tags: *

Method Summary

Public Methods
public

receive(commandList: Command[])

Receive a list of commands from the previous engine, remove all tags which are an instance of at least one of the meta tags provided in the constructor, and then send them on to the next compiler engine.

Private Methods
private

_isTagIn(tag: function): *

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

Override:

BasicEngine#constructor

Params:

NameTypeAttributeDescription
tags Array<function>

A list of meta tag classes (e.g., [ComputeTag, UncomputeTag]) denoting the tags to remove

Private Members

private _tags: * source

Public Methods

public receive(commandList: Command[]) source

Receive a list of commands from the previous engine, remove all tags which are an instance of at least one of the meta tags provided in the constructor, and then send them on to the next compiler engine.

Override:

BasicEngine#receive

Params:

NameTypeAttributeDescription
commandList Command[]

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

Private Methods

private _isTagIn(tag: function): * source

Params:

NameTypeAttributeDescription
tag function

Return:

*