cunqa.qpu.QPU
- class cunqa.qpu.QPU(id: int, qclient: cunqa.qclient.QClient, backend: Backend, family: str, endpoint: tuple[str, int])
Bases:
object
Class to represent a virtual QPU deployed for user interaction.
This class contains the neccesary data for connecting to the virtual QPU’s server in order to communicate circuits and results in both ways. This communication is stablished trough the
QPU.qclient
.
Attributes
|
Object that provides the characteristics that the simulator at the virtual QPU uses to emulate a real device. |
|
Id string assigned to the object. |
Methods
- QPU.__init__(id: int, qclient: cunqa.qclient.QClient, backend: Backend, family: str, endpoint: tuple[str, int])
Initializes the
QPU
class.This initialization of the class is done by the
get_QPUs()
function, which loads the id, family and endpoint, and instanciates the qclient and the backend objects.- Parameters:
id (
str
) – id string assigned to the object.qclient (
QClient
) – object that holds the information to communicate with the server endpoint of the corresponding virtual QPU.backend (
Backend
) – object that provides the characteristics that the simulator at the virtual QPU uses to emulate a real device.family (
str
) – name of the family to which the corresponding virtual QPU belongs.endpoint (
str
) – string refering to the endpoint of the corresponding virtual QPU.
- QPU.run(circuit: dict | CunqaCircuit | qiskit.QuantumCircuit, transpile: bool = False, initial_layout: list[int] | None = None, opt_level: int = 1, **run_parameters: Any) QJob
Class method to send a circuit to the corresponding virtual QPU.
It is important to note that if transpile is set
False
, we asume user has already done the transpilation, otherwise some errors during the simulation can occur.Possible instructions to add as **run_parameters depend on the simulator, but mainly shots and method are used.
- Parameters:
circuit (
dict
|qiskit.QuantumCircuit
|CunqaCircuit
) – circuit to be simulated at the virtual QPU.transpile (
bool
) – if True, transpilation will be done with respect to the backend of the given QPU. Default is set to False.initial_layout (
list[int]
) – Initial position of virtual qubits on physical qubits for transpilation.opt_level (
int
) – optimization level for transpilation, default set to 1.**run_parameters – any other simulation instructions.
- Returns:
A
QJob
object related to the job sent.
Warning
If transpile is set
False
and transpilation instructions (initial_layout, opt_level) are provided, they will be ignored.Note
Transpilation is the process of translating circuit instructions into the native gates of the destined backend accordingly to the topology of its qubits. If this is not done, the simulatior receives the instructions but associates no error, so simulation outcome will not be correct.