IBM5QubitMapper
Extends:
Mapper for the 5-qubit IBM backend.
Maps a given circuit to the IBM Quantum Experience chip.
Note: The mapper has to be run once on the entire circuit.
Warning: If the provided circuit cannot be mapped to the hardware layout without performing Swaps, the mapping procedure *raises an Exception**.
Constructor Summary
| Public Constructor | ||
| public |
|
|
Member Summary
| Public Members | ||
| public |
currentMapping: {} |
|
| Private Members | ||
| private |
_cmds: *[] |
|
| private |
_interactions: {} |
|
Method Summary
| Public Methods | ||
| public |
determineCost(mapping: Object): number Determines the cost of the circuit with the given mapping. |
|
| public |
isAvailable(cmd: Command): * Check if the IBM backend can perform the Command cmd and return true if so. |
|
| public |
Receives a command list and, for each command, stores it until completion. |
|
| public |
run() Runs all stored gates. |
|
| Private Methods | ||
| private |
Check if the command corresponds to a CNOT (controlled NOT gate). |
|
| private |
_reset() |
|
| private |
Store a command and handle CNOTs. |
|
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. |
|
| From class BasicMapperEngine | ||
| public get |
|
|
| public set |
|
|
| private |
|
|
| public |
sendCMDWithMappedIDs(cmd: Command) Send this Command using the mapped qubit ids of this.current_mapping. |
|
Public Constructors
Public Methods
public determineCost(mapping: Object): number source
Determines the cost of the circuit with the given mapping.
Params:
| Name | Type | Attribute | Description |
| mapping | Object | Dictionary with key, value pairs where keys are logical qubit ids and the corresponding value is the physical location on the IBM Q chip. |
Return:
| number | Cost measure taking into account CNOT directionality or None if the circuit cannot be executed given the mapping. |
public isAvailable(cmd: Command): * source
Check if the IBM backend can perform the Command cmd and return true if so.
Override:
BasicEngine#isAvailableParams:
| Name | Type | Attribute | Description |
| cmd | Command | The command to check |
Return:
| * |
public receive(commandList: Command[]) source
Receives a command list and, for each command, stores it until completion.
Override:
BasicEngine#receiveParams:
| Name | Type | Attribute | Description |
| commandList | Command[] | list of commands to receive. |
Throw:
If mapping the CNOT gates to 1 qubit would require Swaps. The current version only supports remapping of CNOT gates without performing any Swaps due to the large costs associated with Swapping given the CNOT constraints. |
public run() source
Runs all stored gates.
Throw:
If the mapping to the IBM backend cannot be performed or if the mapping was already determined but more CNOTs get sent down the pipeline. |
Private Methods
private _isCNOT(cmd: Command): * source
Check if the command corresponds to a CNOT (controlled NOT gate).
Params:
| Name | Type | Attribute | Description |
| cmd | Command | Command to check whether it is a controlled NOT gate. |
Return:
| * |