data_extracting
This module contains auxiliary functions for executing QLM programs based on QLM Routines or QLM gates and for post processing results from QLM qpu executions
Authors: Alberto Pedro Manzano Herrero & Gonzalo Ferro Costas
- QQuantLib.utils.data_extracting.create_qcircuit(prog_q)
Given a QLM program creates a QLM circuit
- Parameters:
prog_q (QLM QProgram)
- Returns:
circuit
- Return type:
QLM circuit
- QQuantLib.utils.data_extracting.create_qjob(circuit, shots=0, qubits=None)
Given a QLM circuit creates a QLM job
- Parameters:
circuit (QLM circuit)
shots (int) – number of measurmentes
qubits (list) – with the qubits to be measured
- Returns:
job – job for submit to QLM QPU
- Return type:
QLM job
- QQuantLib.utils.data_extracting.create_qprogram(quantum_gate)
Creates a Quantum Program from an input qlm gate or routine
- Parameters:
quantum_gate (QLM gate or QLM routine)
- Returns:
q_prog – Quantum Program from input QLM gate or routine
- Return type:
QLM Program.
- QQuantLib.utils.data_extracting.get_results(quantum_object, linalg_qpu, shots: int = 0, qubits: list | None = None, complete: bool = False)
Function for testing an input gate. This function creates the quantum program for an input gate, the correspondent circuit and job. Execute the job and gets the results
- Parameters:
quantum_object (QLM Gate, Routine or Program)
linalg_qpu (QLM solver)
shots (int) – number of shots for the generated job. if 0 True probabilities will be computed
qubits (list) – list with the qubits for doing the measurement when simulating if None measurement over all allocated qubits will be provided
complete (bool) – for return the complete basis state. Useful when shots is not 0 and all the posible basis states are necessary.
- Returns:
pdf (pandas DataFrame) – DataFrame with the results of the simulation
circuit (QLM circuit)
q_prog (QLM Program.)
job (QLM job)
- QQuantLib.utils.data_extracting.proccess_qresults(result, qubits, complete=False)
Post Process a QLM results for creating a pandas DataFrame
- Parameters:
result (QLM results from a QLM qpu.) – returned object from a qpu submit
qubits (int) – number of qubits
complete (bool) – for return the complete basis state.