ComputeEngine
Extends:
Adds Compute-tags to all commands and stores them (to later uncompute them automatically)
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
public |
addUnComputeTag(cmd: Command): * Modify the command tags, inserting an UncomputeTag. |
|
public |
End the compute step (exit the Compute() - statement). |
|
public |
If in compute-mode: Receive commands and store deepcopy of each cmd. |
|
public |
Send uncomputing gates. |
Inherited Summary
From class BasicEngine | ||
public |
|
|
public |
allocateQubit(dirty: boolean): Qureg Return a new qubit as a list containing 1 qubit object (quantum register of size 1). |
|
public |
allocateQureg(n: number): Qureg Allocate n qubits and return them as a quantum register, which is a list of qubit objects. |
|
public |
deallocateQubit(qubit: BasicQubit) Deallocate a qubit (and sends the deallocation command down the pipeline). |
|
public |
isAvailable(cmd: Command): boolean 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 |
isMetaTagSupported(metaTag: function): boolean Check if there is a compiler engine handling the meta tag |
|
public |
receive() |
|
public |
Forward the list of commands to the next engine in the pipeline. |
Public Constructors
Public Members
public allocatedQubitIDs: * source
public deallocatedQubitIDs: * source
Private Members
private _l: *[] source
Public Methods
public addUnComputeTag(cmd: Command): * source
Modify the command tags, inserting an UncomputeTag.
Params:
Name | Type | Attribute | Description |
cmd | Command | Command to modify. |
Return:
* |
public endCompute() source
End the compute step (exit the Compute() - statement).
Will tell the Compute-engine to stop caching. It then waits for the uncompute instruction, which is when it sends all cached commands inverted and in reverse order down to the next compiler engine.
Throw:
If qubit has been deallocated in Compute section which has not been allocated in Compute section |
public receive(commandList: Command[]) source
If in compute-mode: Receive commands and store deepcopy of each cmd. Add ComputeTag to received cmd and send it on. Otherwise: send all received commands directly to next_engine.
Override:
BasicEngine#receiveParams:
Name | Type | Attribute | Description |
commandList | Command[] | List of commands to receive. |
public runUnCompute() source
Send uncomputing gates.
Sends the inverse of the stored commands in reverse order down to the next engine. And also deals with allocated qubits in Compute section. If a qubit has been allocated during compute, it will be deallocated during uncompute. If a qubit has been allocated and deallocated during compute, then a new qubit is allocated and deallocated during uncompute.