mqt.qudits.quantum_circuit.qasm

Module Contents

class QASM[source]

Class that manages the parsing of QASM programs.

program: dict[str, Any]
static parse_nonspecial_lines(line: str, rgxs: dict[str, Pattern[str]], in_comment_flag: bool) → tuple[bool, bool][source]
static parse_qreg(line: str, rgxs: dict[str, Pattern[str]], sitemap: dict[tuple[str, int], tuple[int, int]]) → bool[source]
static parse_creg(line: str, rgxs: dict[str, Pattern[str]], sitemap_classic: ClSitemap) → bool[source]
static safe_eval_math_expression(expression: str) → float | None[source]
static parse_gate(line: str, rgxs: dict[str, Pattern[str]], sitemap: dict[tuple[str, int], tuple[int, int]], gates: list[dict[str, Any]]) → bool[source]
static parse_ignore(line: str, rgxs: dict[str, Pattern[str]], warned: dict[str, bool]) → bool[source]
parse_ditqasm2_str(contents: str) → dict[str, Any][source]

Parse the string contents of an OpenQASM 2.0 file.

This parser only supports basic gate_matrix definitions, and is not guaranteed to check the full OpenQASM grammar.

parse_ditqasm2_file(fname: str) → dict[str, Any][source]

Parse an OpenQASM 2.0 file.