qoqo_myqlm
MyQLM interface for qoqo.
Translates qoqo operations and circuits to MyQLM operations via the interface, and Creates a MyQLM file with MyQLMBackend.
|
Translate a qoqo operation to MyQLM text |
|
Translate the qoqo circuit into MyQLM ouput |
|
Backend to qoqo that produces MyQLM output which can be imported. |
Functions
|
Generate the VariableMSXX unitary matrix from https://hqsquantumsimulations.github.io/qoqo_examples/gate_operations/two_qubit_gates.html#variablesmsxx |
|
Translate the qoqo circuit into MyQLM ouput |
|
Translate a qoqo operation to MyQLM text |
Classes
|
Backend to qoqo that produces MyQLM output which can be imported. |
- class qoqo_myqlm.MyQLMBackend(number_qubits: int = 1, number_measurements: int = 1, device: Any | None = None, job_type: str = 'SAMPLE', observable: ndarray | None = None, qpu: Any = None, mode: str = 'active_qubits_only', time_QLM_submission: bool = False)[source]
Backend to qoqo that produces MyQLM output which can be imported.
This backend takes a qoqo circuit to be run on a certain device and returns a MyQLM file containing the translated circuit. The circuit itself is translated using the qoqo_myqlm interface.
Initialize MyQLM Backend
- Parameters:
number_qubits -- The number of qubits to use
number_measurements -- The number of measurement repetitions. If set to 0: - simulator: tries to output all the possible final states (with probabilities) - quantum processor: uses the largest amount of shots authorised by the hardware
device -- The device specification
job_type -- MyQLM job type to run: - SAMPLE (default): measures Z on all qubits - OBS: measures a specific observable, defined by a matrix on all qubits
observable -- if "OBS" is selected as the job type, this is the matrix of the observable to measure.
qpu -- QPU machine to use (quantum processor or simulator) with relevant keywords
mode -- noise mode, can be active_qubits_only, parallelization_blocks, all_qubits
time_QLM_submission -- toggle the print of the timing for the job submission to QLM
- Raises:
TypeError -- Job_type specified is neither 'SAMPLE' nor 'OBS'
- __init__(number_qubits: int = 1, number_measurements: int = 1, device: Any | None = None, job_type: str = 'SAMPLE', observable: ndarray | None = None, qpu: Any = None, mode: str = 'active_qubits_only', time_QLM_submission: bool = False) None [source]
Initialize MyQLM Backend
- Parameters:
number_qubits -- The number of qubits to use
number_measurements -- The number of measurement repetitions. If set to 0: - simulator: tries to output all the possible final states (with probabilities) - quantum processor: uses the largest amount of shots authorised by the hardware
device -- The device specification
job_type -- MyQLM job type to run: - SAMPLE (default): measures Z on all qubits - OBS: measures a specific observable, defined by a matrix on all qubits
observable -- if "OBS" is selected as the job type, this is the matrix of the observable to measure.
qpu -- QPU machine to use (quantum processor or simulator) with relevant keywords
mode -- noise mode, can be active_qubits_only, parallelization_blocks, all_qubits
time_QLM_submission -- toggle the print of the timing for the job submission to QLM
- Raises:
TypeError -- Job_type specified is neither 'SAMPLE' nor 'OBS'
- __weakref__
list of weak references to the object
- run_circuit(circuit: Circuit) Tuple[Dict[str, List[List[bool]]], Dict[str, List[List[float]]], Dict[str, List[List[complex]]]] [source]
Turn the circuit into MyQLM and save to file
- Parameters:
circuit -- The circuit that is run
- Returns:
- Tuple[Dict[str, List[List[bool]]],
Dict[str, List[List[float]]], Dict[str, List[List[complex]]]]
- run_measurement(measurement: Any) Dict[str, float] | None [source]
Run a circuit with the PyQuEST backend
- Parameters:
measurement -- The measurement that is run
- Returns:
Optional[Dict[str, float]]
- run_measurement_registers(measurement: Any) Tuple[Dict[str, List[List[bool]]], Dict[str, List[List[float]]], Dict[str, List[List[complex]]]] [source]
Run all circuits of a measurement with the PyQuEST backend
- Parameters:
measurement -- The measurement that is run
- Returns:
- Tuple[Dict[str, List[List[bool]]],
Dict[str, List[List[float]]], Dict[str, List[List[complex]]]]
- qoqo_myqlm.generate_VariableMSXX_matrix(theta: float)[source]
Generate the VariableMSXX unitary matrix from https://hqsquantumsimulations.github.io/qoqo_examples/gate_operations/two_qubit_gates.html#variablesmsxx
- qoqo_myqlm.myqlm_call_circuit(circuit: Circuit, number_qubits: int, noise_mode_all_qubits: bool = False, **kwargs) Program [source]
Translate the qoqo circuit into MyQLM ouput
The qoqo_myqlm interface iterates through the qoqo circuit and translates each qoqo operation to MyQLM output (strings).
- Parameters:
circuit -- The qoqo circuit that is translated
number_qubits -- Number of qubits in the quantum register
noise_mode_all_qubits -- boolean to indicate whether to apply noise to all qubits or only to active qubits
**kwargs -- Additional keyword arguments
- Returns:
translated circuit
- Return type:
qlm.Program
- qoqo_myqlm.myqlm_call_operation(operation: Any, qureg: qalloc) List [source]
Translate a qoqo operation to MyQLM text
- Parameters:
operation -- The qoqo operation that is translated
qureg -- The quantum register pyquest_cffi operates on
- Returns:
arguments to be used in the "apply" function
- Return type:
List
- Raises:
RuntimeError -- Operation not in MyQLM backend