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

IBM5QubitMapper

Extends:

BasicEngineBasicMapperEngine → IBM5QubitMapper

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
Private Members
private

_cmds: *[]

private

Method Summary

Public Methods
public

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

receive(commandList: Command[])

Receives a command list and, for each command, stores it until completion.

public

run()

Runs all stored gates.

Private Methods
private

_isCNOT(cmd: Command): *

Check if the command corresponds to a CNOT (controlled NOT gate).

private

_reset()

private

_store(cmd: Command)

Store a command and handle CNOTs.

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.

From class BasicMapperEngine
public get
public set
private
public

Send this Command using the mapped qubit ids of this.current_mapping.

Public Constructors

public constructor() source

Override:

BasicMapperEngine#constructor

Public Members

public currentMapping: {} source

Override:

BasicMapperEngine#currentMapping

Private Members

private _cmds: *[] source

private _interactions: {} source

Public Methods

public determineCost(mapping: Object): number source

Determines the cost of the circuit with the given mapping.

Params:

NameTypeAttributeDescription
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#isAvailable

Params:

NameTypeAttributeDescription
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#receive

Params:

NameTypeAttributeDescription
commandList Command[]

list of commands to receive.

Throw:

Error

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:

Error

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:

NameTypeAttributeDescription
cmd Command

Command to check whether it is a controlled NOT gate.

Return:

*

private _reset() source

private _store(cmd: Command) source

Store a command and handle CNOTs.

Params:

NameTypeAttributeDescription
cmd Command

A command to store