ResourceCounter
Extends:
ResourceCounter is a compiler engine which counts the number of gates and max. number of active qubits.
Attributes: gate_counts (dict): Dictionary of gate counts. The keys are tuples of the form (cmd.gate, ctrl_cnt), where ctrl_cnt is the number of control qubits. gate_class_counts (dict): Dictionary of gate class counts. The keys are tuples of the form (cmd.gate.class, ctrl_cnt), where ctrl_cnt is the number of control qubits. max_width (int): Maximal width (=max. number of active qubits at any given point). Properties: depth_of_dag (int): It is the longest path in the directed acyclic graph (DAG) of the program.
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public get |
depthOfDag: number: * |
|
public |
|
|
public |
gate_counts: {} |
|
public |
|
Private Members | ||
private |
|
|
private |
_depth_of_qubit: {} |
|
private |
|
Method Summary
Public Methods | ||
public |
|
|
public |
isAvailable(cmd: Command): boolean Specialized implementation of isAvailable: Returns true if the ResourceCounter is the last engine (since it can count any command). |
|
public |
|
|
public |
Return the string representation of this ResourceCounter. |
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 gate_class_counts: {} source
public gate_counts: {} source
Private Members
private _depth_of_qubit: {} source
Public Methods
public isAvailable(cmd: Command): boolean source
Specialized implementation of isAvailable: Returns true if the ResourceCounter is the last engine (since it can count any command).
Override:
BasicEngine#isAvailableParams:
Name | Type | Attribute | Description |
cmd | Command | Command for which to check availability (all Commands can be counted). |
public receive(commandList: Command[]) source
Override:
BasicEngine#receiveParams:
Name | Type | Attribute | Description |
commandList | Command[] |