Module backend_qx
- class QIBackend(num_runs=1024, verbose=0, quantum_inspire_api=None, backend_type=None)[source]
Bases:
BasicEngine
Backend for Quantum Inspire
Initialize the Backend object.
- Parameters:
num_runs (int) – Number of runs to collect statistics (default is 1024).
verbose (int) – Verbosity level, defaults to 0, which produces no extra output.
quantum_inspire_api (QuantumInspireAPI | None) – Connection to QI platform, optional parameter.
backend_type (int | str | None) – Backend to use for execution. When no backend_type is provided, the default backend will be used.
- Raises:
AuthenticationError – When an authentication error occurs.
- property one_qubit_gates: Tuple[Any, ...]
Return the one qubit gates as a tuple
- property two_qubit_gates: Tuple[Any, ...]
Return the two qubit gates as a tuple
- property three_qubit_gates: Tuple[Any, ...]
Return the three qubit gates as a tuple
- property qasm: str
Return qasm code at any moment in the process.
- is_available(cmd)[source]
Via this method the ProjectQ framework determines which commands (gates) are available in the backend.
- Parameters:
cmd (Command) – Command with a gate for which to check availability.
- Returns:
True when the gate in the command is available on the Quantum Inspire backend.
- Return type:
bool
- get_probabilities(qureg)[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!
- Parameters:
qureg (List[Qubit]) – Quantum register of size n determining the contents of the probability states.
- Returns:
Dictionary mapping n-bit strings of
0
and1
to probabilities.- Raises:
RuntimeError – 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).
- Return type:
Dict[str, float]
- get_probabilities_multiple_measurement(qureg)[source]
For each measurement block return the 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!
- Parameters:
qureg (List[Qubit]) – Quantum register of size n determining the contents of the probability states.
- Returns:
List of dictionaries mapping n-bit strings of
0
and1
to probabilities for each measurement block.- Raises:
RuntimeError – 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).
- Return type:
List[Dict[str, float]]