quairkit.core.operator.transpile

Source file for transpilation between OperatorInfo and [OpenQASM 2.0](https://github.com/openqasm/openqasm/tree/OpenQASM2.x)

class quairkit.core.operator.transpile.OpenQASM2Transpiler

A class to handle the translation between OperatorInfo and OpenQASM 2.0 format.

This class provides methods to convert operator information into OpenQASM 2.0 format and to handle equivalent translations for specific operators.

static format_qasm(name, system_idx, param)

Translate OperatorInfo to OpenQASM-like format.

Parameters:
name : str

The name of the operator.

system_idx : List[List[int]]

The indices of the systems the operator acts upon.

param : Tensor | None

The parameters of the operator, if any.

Returns:

The OpenQASM-like representation of the operator.

Return type:

str

static transpile(name, system_idx, param)

Translate OperatorInfo to OpenQASM 2.0 format.

Parameters:
name : str

The name of the operator.

system_idx : List[List[int]]

The indices of the systems the operator acts upon.

param : Tensor | None

The parameters of the operator, if any.

Returns:

The OpenQASM 2.0 representation of the operator.

Return type:

str