qoqo_qir

QIR interface and backend for qoqo.

Translates qoqo operations and circuits to QIR operations via the interface, and Create a QIR file with QirBackend.

QirBackend([qir_profile, qir_version])

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

Classes

QirBackend([qir_profile, qir_version])

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

class qoqo_qir.QirBackend(qir_profile=None, qir_version=None)

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

This backend takes a qoqo circuit to be run on a certain device and returns a QIR file containing the translated circuit. The circuit itself is translated using the qoqo_qir interface. In this backend, the initialization sets up the relevant parameters and the run function calls the QIR interface and writes the QIR file, which is saved to be used by the user on whatever platform they see fit. QIR input is widely supported on various quantum computing platforms.

__new__(**kwargs)
circuit_to_qir_file(circuit, folder_name=Ellipsis, filename=Ellipsis, overwrite=True, measure_all=False)

Translates a Circuit to a QIR 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 QIR text is saved to.

  • overwrite -- Whether to overwrite file if it already exists.

Returns:

The QIR file was correctly written

Return type:

Ok(())

Raises:
  • TypeError -- Circuit conversion error

  • ValueError -- Operation not in QIR backend

circuit_to_qir_str(circuit, measure_all=False)

Translates a Circuit to a QIR string.

Parameters:

circuit -- The Circuit items that is translated

Returns:

The QIR string

Return type:

str

Raises:
  • TypeError -- Circuit conversion error

  • ValueError -- Operation not in QIR backend