qoqo_qasm

QASM interface and backend for qoqo.

Translates qoqo operations and circuits to QASM operations via the interface, and Create a Qasm file with QasmBackend.

qasm_call_operation(operation, ...)

Translate a qoqo operation to QASM text

qasm_call_circuit(circuit, ...)

Translate the qoqo circuit into QASM ouput

QasmBackend

Backend to qoqo that produces QASM output which can be imported.

Functions

qasm_call_circuit(circuit, ...)

Translate the qoqo circuit into QASM ouput

qasm_call_operation(operation, ...)

Translate a qoqo operation to QASM text

Classes

QasmBackend

Backend to qoqo that produces QASM output which can be imported.

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.

__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

qoqo_qasm.qasm_call_circuit(circuit, qubit_register_name, qasm_version)

Translate the qoqo circuit into QASM ouput

The qoqo_qasm interface iterates through the qoqo circuit and translates each qoqo operation to QASM output (strings).

Parameters:
  • circuit (Circuit) – The qoqo circuit that is translated

  • qubit_register_name (str) – The name of the quantum register

Returns:

The translated circuit

Return type:

List[str]

Raises:
  • TypeError – Circuit conversion error

  • ValueError – Operation not in QASM backend

qoqo_qasm.qasm_call_operation(operation, qubit_register_name, qasm_version)

Translate a qoqo operation to QASM text

Parameters:
  • operation – The qoqo operation that is translated

  • qubit_register_name (str) – The name of the quantum register

Returns:

The translated operation

Return type:

str

Raises:
  • TypeError – Operation conversion error

  • ValueError – Operation not in QASM backend