qoqo_qasm.QasmBackend
- class qoqo_qasm.QasmBackend
Backend to qoqo that produces QASM output which can be imported.
This backend takes a qoqo circuit to be run on a certain device and returns a QASM file containing the translated circuit. The circuit itself is translated using the qoqo_qasm interface. In this backend, the initialization sets up the relevant parameters and the run function calls the QASM interface and writes the QASM file, which is saved to be used by the user on whatever platform they see fit. QASM input is widely supported on various quantum computing platforms.
- __init__()
Methods
__init__
()circuit_to_qasm_file
(circuit, folder_name, ...)Translates a Circuit to a QASM file.
circuit_to_qasm_str
(circuit)Translates a Circuit to a valid QASM string.
- __new__(**kwargs)
- circuit_to_qasm_file(circuit, folder_name, filename, overwrite)
Translates a Circuit to a QASM file.
- Parameters:
circuit – The Circuit that is translated
folder_name – The name of the folder that is prepended to all filenames.
filename – The name of the file the QASM text is saved to.
overwrite – Whether to overwrite file if it already exists.
- Returns:
The qasm file was correctly written
- Return type:
Ok(())
- Raises:
TypeError – Circuit conversion error
ValueError – Operation not in QASM backend
- circuit_to_qasm_str(circuit)
Translates a Circuit to a valid QASM string.
- Parameters:
circuit – The Circuit items that is translated
- Returns:
The valid QASM string
- Return type:
str
- Raises:
TypeError – Circuit conversion error
ValueError – Operation not in QASM backend