qilisdk.utils.openqasm2
Attributes
Functions
|
Convert the circuit to an OpenQASM 2.0 formatted string. |
|
Save the QASM representation to a file. |
|
Parse an OpenQASM 2.0 string and create a corresponding Circuit instance. |
|
Read an OpenQASM 2.0 file and create a corresponding Circuit instance. |
Module Contents
- OPENQASM2_MAP: dict[type[qilisdk.digital.gates.Gate], str][font]
- to_qasm2(circuit: qilisdk.digital.circuit.Circuit) str[font]
Convert the circuit to an OpenQASM 2.0 formatted string.
- Paràmetres:
circuit – The circuit to convert to OpenQASM 2.0.
- Retorna:
The OpenQASM 2.0 representation of the circuit.
- Tipus de retorn:
str
- to_qasm2_file(circuit: qilisdk.digital.circuit.Circuit, filename: str) None[font]
Save the QASM representation to a file.
- Paràmetres:
circuit – The circuit to convert to OpenQASM 2.0.
filename (
str) – The path to the file where the QASM code will be saved.
- from_qasm2(qasm_str: str) qilisdk.digital.circuit.Circuit[font]
Parse an OpenQASM 2.0 string and create a corresponding Circuit instance.
- This parser supports the following instructions:
Quantum register declaration (e.g., «qreg q[3];»)
Classical register declaration (ignored)
Gate instructions (one-qubit and two-qubit gates)
Measurement instructions (e.g., «measure q[0] -> c[0];»)
- Paràmetres:
qasm_str (
str) – The QASM string to parse.- Retorna:
The constructed Circuit object.
- Tipus de retorn:
Circuit
- from_qasm2_file(filename: str) qilisdk.digital.circuit.Circuit[font]
Read an OpenQASM 2.0 file and create a corresponding Circuit instance.
- Paràmetres:
filename (
str) – The path to the QASM file.- Retorna:
The reconstructed Circuit object.
- Tipus de retorn:
Circuit