IBMBackend
Extends:
The IBM Backend class, which stores the circuit, transforms it to JSON QASM, and sends the circuit through the IBM API.
Constructor Summary
| Public Constructor | ||
| public | 
       constructor(args: {use_hardware: boolean, num_runs: number, verbose: boolean, user: string, password: string, device: string, retrieve_execution: ?string})  | 
    |
Member Summary
| Public Members | ||
| public | 
       device: *  | 
    |
| public get | 
      
       | 
    |
| public set | 
       didRunCallback(callback: function)  | 
    |
| public get | 
      
       | 
    |
| public | 
      
       | 
    |
| Private Members | ||
| private | 
      
       | 
    |
| private | 
      
       | 
    |
| private | 
      
       | 
    |
| private | 
       _errors: *[]  | 
    |
| private | 
       _measured_ids: *[]  | 
    |
| private | 
       _num_runs: *  | 
    |
| private | 
       _password: *  | 
    |
| private | 
       _probabilities: {}  | 
    |
| private | 
      
       | 
    |
| private | 
       _user: *  | 
    |
| private | 
       _verbose: *  | 
    |
Method Summary
| Public Methods | ||
| public | 
       addError(error: *)  | 
    |
| public | 
       getProbabilities(qureg: Array<Qubit> | Qureg): Object Return the list of basis states with corresponding probabilities.  | 
    |
| public | 
       isAvailable(cmd: Command): boolean Return true if the command can be executed.  | 
    |
| public | 
      
       Receives a command list and, for each command, stores it until completion.  | 
    |
| public | 
       async run() Run the circuit.  | 
    |
| Private Methods | ||
| private | 
       _logicalToPhysical(qbID: number): * Return the physical location of the qubit with the given logical id.  | 
    |
| private | 
       _reset()  | 
    |
| private | 
      
       Temporarily store the command cmd.  | 
    |
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 constructor(args: {use_hardware: boolean, num_runs: number, verbose: boolean, user: string, password: string, device: string, retrieve_execution: ?string}) source
Override:
BasicEngine#constructorParams:
| Name | Type | Attribute | Description | 
| args | {use_hardware: boolean, num_runs: number, verbose: boolean, user: string, password: string, device: string, retrieve_execution: ?string} | use_hardware: If true, the code is run on the IBM quantum chip (instead of using the IBM simulator) num_runs: Number of runs to collect statistics. (default is 1024) verbose: If true, statistics are printed, in addition to the measurement result being registered (at the end of the circuit). user: IBM Quantum Experience user name password: IBM Quantum Experience password device: Device to use ('ibmqx4', or 'ibmqx5') if use_hardware is set to true. Default is ibmqx4. retrieve_execution: Job ID to retrieve instead of re-running the circuit (e.g., if previous run timed out).  | 
    
Public Members
public device: * source
Private Members
private _allocated_qubits: * source
private _didRunCallback: * source
private _errors: *[] source
private _measured_ids: *[] source
private _num_runs: * source
private _password: * source
private _probabilities: {} source
private _retrieve_execution: * source
private _user: * source
private _verbose: * source
Public Methods
public addError(error: *) source
Params:
| Name | Type | Attribute | Description | 
| error | * | 
public getProbabilities(qureg: Array<Qubit> | Qureg): Object source
Return the list of basis states with corresponding probabilities.
The measured bits are ordered according to the supplied quantum register, i.e., the left-most bit in the state-string corresponds to the first qubit in the supplied quantum register.
Warning: Only call this function after the circuit has been executed!
Throw:
If no data is available (i.e., if the circuit has not been executed). Or if a qubit was supplied which was not present in the circuit (might have gotten optimized away).  | 
      
public isAvailable(cmd: Command): boolean source
Return true if the command can be executed.
The IBM quantum chip can do X, Y, Z, T, Tdag, S, Sdag, rotation gates, barriers, and CX / CNOT.
Override:
BasicEngine#isAvailableParams:
| Name | Type | Attribute | Description | 
| cmd | Command | Command for which to check availability  | 
    
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 execute  | 
    
public async run() source
Run the circuit.
Send the circuit via the IBM API (JSON QASM) using the provided user data / ask for username & password.
Private Methods
private _logicalToPhysical(qbID: number): * source
Return the physical location of the qubit with the given logical id.
Params:
| Name | Type | Attribute | Description | 
| qbID | number | ID of the logical qubit whose position should be returned.  | 
    
Return:
| * |