qstone.apps package¶
Submodules¶
qstone.apps.PyMatching module¶
Defines the two steps of PyMatching jobs
- class qstone.apps.PyMatching.PyMatching(cfg: dict)[source]¶
Bases:
Computation
PyMatching computation class.
- CFG_STRING: str | None = '\n {\n "cfg":\n {\n "num_required_qubits" : 10,\n "repetitions": 2\n }\n }\n '¶
- COMPUTATION_NAME: str = 'PyMatching'¶
- SCHEMA: DataFrameSchema = <Schema DataFrameSchema(columns={'repetitions': <Schema Column(name=repetitions, type=DataType(int64))>}, checks=[], parsers=[], index=None, dtype=None, coerce=False, strict=False, name=None, ordered=False, unique=None, report_duplicates=all, unique_column_names=False, add_missing_columns=False, title=None, description=None, metadata=None, drop_invalid_rows=False)>¶
- generate_synthetic_data(data_path: str)[source]¶
Generates synthetic data and stores them in data_path
- get_creg_indexes(qasm_content: str)[source]¶
Parse a QASM file content to determine the indexes of classical registers (cregs) assuming first-come-first-serve allocation.
- Parameters:
qasm_content (str) – Content of the QASM file as a string
- Returns:
Dictionary mapping creg names to their bit ranges as tuples (start, end)
- Return type:
dict
- post(datapath: str)[source]¶
Runs the postprocessing analysis using PyMatching decoder over a given input file
- Parameters:
datapath – path location to write circuit
Returns: number of errors detected
qstone.apps.QBC module¶
QBC computations steps.
- class qstone.apps.QBC.QBC(cfg: dict)[source]¶
Bases:
Computation
QBC computation class.
- CFG_STRING: str | None = '\n {\n "cfg":\n {\n "num_required_qubits" : 4,\n "pqc_number" : 2,\n "training_size" : 20,\n "max_iters" : 10,\n "shots" : 64\n }\n }\n '¶
- COMPUTATION_NAME: str = 'QBC'¶
- SCHEMA: DataFrameSchema = <Schema DataFrameSchema(columns={'pqc_number': <Schema Column(name=pqc_number, type=DataType(int64))>, 'training_size': <Schema Column(name=training_size, type=DataType(int64))>, 'max_iters': <Schema Column(name=max_iters, type=DataType(int64))>, 'shots': <Schema Column(name=shots, type=DataType(int64))>}, checks=[], parsers=[], index=None, dtype=None, coerce=False, strict=False, name=None, ordered=False, unique=None, report_duplicates=all, unique_column_names=False, add_missing_columns=False, title=None, description=None, metadata=None, drop_invalid_rows=False)>¶
- qstone.apps.QBC.generate_vqc_qasm(pqc_number, num_qubits, datum, parameters)[source]¶
Generates text for a qasm file of a Quantum Circuit (QC) consisting of encoding layers encoding a datum and Variational Quantum Circuit (VQC) with trainable parameters. The encoding layers are Rz and Rx layers at the beggining and end of the QC taking the datum as rotational angles. The VQC form can be chosen via pqc_number = {2, 5, 15} The pqc_number parameters references the QCs with the same number in figure 2 of Adv. Quantum Technol. 2019, 2, 1900070
qstone.apps.RB module¶
RB computations steps.
- class qstone.apps.RB.RB(cfg: dict)[source]¶
Bases:
Computation
Type 1 computation class.
- CFG_STRING: str | None = '\n {\n "cfg":\n {\n "num_required_qubits" : 2,\n "repetitions": 2\n }\n } \n '¶
- COMPUTATION_NAME: str = 'RB'¶
- SCHEMA: DataFrameSchema = <Schema DataFrameSchema(columns={'repetitions': <Schema Column(name=repetitions, type=DataType(int64))>}, checks=[], parsers=[], index=None, dtype=None, coerce=False, strict=False, name=None, ordered=False, unique=None, report_duplicates=all, unique_column_names=False, add_missing_columns=False, title=None, description=None, metadata=None, drop_invalid_rows=False)>¶
- post(datapath: str)[source]¶
Runs the processing of the randomised benchmarking using the data provided by datapath
qstone.apps.VQE module¶
VQE computations steps.
- class qstone.apps.VQE.VQE(cfg: dict)[source]¶
Bases:
Computation
VQE computation class.
- CFG_STRING: str | None = '\n {\n "cfg":\n {\n "num_required_qubits" : 4,\n "repetitions" : 10,\n "iterations" : 10,\n "compute_duration" : 1\n }\n }\n '¶
- COMPUTATION_NAME: str = 'VQE'¶
- SCHEMA: DataFrameSchema = <Schema DataFrameSchema(columns={'repetitions': <Schema Column(name=repetitions, type=DataType(int64))>, 'iterations': <Schema Column(name=iterations, type=DataType(int64))>, 'compute_duration': <Schema Column(name=compute_duration, type=DataType(int64))>}, checks=[], parsers=[], index=None, dtype=None, coerce=False, strict=False, name=None, ordered=False, unique=None, report_duplicates=all, unique_column_names=False, add_missing_columns=False, title=None, description=None, metadata=None, drop_invalid_rows=False)>¶
qstone.apps.computation module¶
QPU computation class and configuration dataclass
- class qstone.apps.computation.Computation(cfg: Dict)[source]¶
Bases:
ABC
Abstract class for a QPU computation. To be ovverriden by implemented jobs.
- Parameters:
cfg – Computation configuration dictionary. Key value pairs describing
data. (the script)
- BASEPATH: str = '/home/runner/work/QStone/QStone/qstone/apps/..'¶
- CFG_PATH: str | None = None¶
- CFG_STRING: str | None = None¶
- COMPUTATION_NAME: str¶
- SCHEMA: DataFrameSchema¶
- dump_cfg() str [source]¶
Serializes computation script information into JSON string.
Returns json string representation of computation configuration.
- classmethod from_json(path: str | None = None)[source]¶
Factory method for creating computation via JSON configuration.
- Parameters:
path – Path to computation configuration file
- property qpu_cfg¶
qpu_cfg getter
Module contents¶
QPU Computation registry