The goal of this project is to create the code allowing to redo the experiments of the paper below and analyze the practical behaviour of the classical completion and to improve the Runtime.
Every study are available in the study folder.
In order to authenticate to IBM Cloud or IBM Quantum and to use run time, you can all this method.
authentication(channel=None, token=None, instance="ibm-q/open/main", overwrite=False)
Parameters
Literal
[‘ibm_cloud’, ‘ibm_quantum’]]) – Channel type. ibm_cloud or ibm_quantum.str
]) - IBM Cloud API key or IBM Quantum API token.str
]) - The service instance to use. For ibm_cloud runtime, this is the Cloud Resource Name (CRN) or the service name. For ibm_quantum runtime, this is the hub/group/project in that format.bool
]) - To overwrite your actual tokenReturn
Examples
python workflow.py authentication --channel="cloud" --token="your_very_long_token" --instance="ibm-q/open/main"
To run the full workflow, you can call this method.
end2end(circuit_tpl_id=None, width=3, layer=1, matrix_size=None, payload_limit=2e9, backend="ibmq_qasm_simulator", shots=1024)
Parameters
int
[2, 5, 10, 18]]) - list of circuit id to run as templateOptionnal
[int
, ...]) - number of qubits to useOptionnal
[int
]) - number of repetition for each circuitOptionnal
[int
, int
]) - matrix size for seed coordinate [x, y]
; can't be use with seed1 and seed2Optionnal
[int
]) - limit size for each part of the payload to send to the Runtime Optionnal
[str
]) - backend for running circuitOptionnal
[int
]) - number of shots for each circuitReturn
Examples
python workflow.py end2end_flow --circuit_tpl_id=[5] --matrix_size=[100,100]
The following endpoints allow you to generate the quantum kernel of the size given and to see and analyze it.
To only run the kernel generation, you can use this method.
kernel_flow(circuit_tpl_id=None, width=3, layer=1, seed1=42, seed2=4242, matrix_size=None, payload_limit=2e9, backend="ibmq_qasm_simulator", shots=1024)
Parameters
int
[2, 5, 10, 18]]) - list of circuit id to run as templateOptionnal
[int
, ...]) - number of qubits to useOptionnal
[int
]) - number of repetition for each circuitOptionnal
[int
]) - seed for axe x ; can't be use with matrix_sizeOptionnal
[int
]) - seed for axe y ; can't be use with matrix_sizeOptionnal
[int
, int
]) - matrix size for seed coordinate [x, y]
; can't be use with seed1 and seed2Optionnal
[int
]) - limit size for each part of the payload to send to the Runtime Optionnal
[str
]) - backend for running circuitOptionnal
[int
]) - number of shots for each circuitReturn
Examples
seed1
and seed2
.
python workflow.py kernel_flow --circuit_tpl_id=[2,5] --seed1=24 --seed2=2424
matrix_size
in order to generate a full matrix data.
python workflow.py kernel_flow --circuit_tpl_id=[5] --matrix_size=[20,20]
To see your kernel generated, you can use this method.
view_kernel(file_name=None, backend="ibmq_qasm_simulator", resources_path="resources/kernel_metadata")
Parameters
str
]) - name of the file to decodeOptionnal
[str
]) - backend of the experiment of the resource fileOptionnal
[str
]) - path of the resources folderReturn
file_name
decode as pandas.DataframeExamples
python workflow.py view_kernel --file_name="kernels-2-ideal.csv"
The following endpoints allow you to run the completion matrix algorithm of the kernel given and to see and analyze it.
Generate the completion of the kernel given. To only run the matrix completion over a quantum kernel, you can use this method.
completion_flow(file_name=None, backend="ibmq_qasm_simulator", nb_qubits=None, size_matrix=None, overlaps=1)
Parameters
str
]) - name of the kernel to make to completionOptional
[str
]) - name of the backend used for generate the kernelint
]) - number of qubits used for generate the kernelOptionnal
[int
, int
]) - size [x, y]
of the matrix ; used in case of not using the entire kernelOptionnal
[float
]) - customize the overlaps in %Return
Examples
python workflow.py completion_flow --file_name="kernels-2-ideal.csv" --nb_qubits=3
To see your matrix generated, you can used this method.
view_matrix(file_name=None, backend="ibmq_qasm_simulator", resources_path="resources/cmpl_matrix")
Parameters
str
]) - name of the file to decodeOptionnal
[str
]) - backend of the experiment of the resource fileOptionnal
[str
]) - path of the resources folderReturn
file_name
decode as matrixExamples
python workflow.py view_matrix --file_name="kernels-2-ideal.csv.npy"
Each flow are generating a telemetry in order to analyze the behaviour of their flow and having some metadata to study.
To see your telemetry files, you can used this method.
view_telemetry(file_name="telemetry_info.csv", resources_path="resources/kernel_metadata")
Parameters
Optionnal
[str
]) - name of the file to decodeOptionnal
[str
[‘resources/kernel_metadata‘, ‘resources/cmpl_matrix‘]]) - path of the resources folderReturn
file_name
decode as pandas.DataframeExamples
python workflow.py view_telemetry --resources_path="resources/kernel_metadata"
python workflow.py view_telemetry --resources_path="resources/cmpl_matrix"
≥ 0
and at least one = 0