Module qasm3

Module qasm3 

Source
Expand description

OpenQASM 3.0 support for QuantRS2.

This module provides QASM 3.0 circuit representation and conversion, compatible with IBM Quantum and other modern quantum systems.

§Features

  • Full OpenQASM 3.0 syntax support
  • Classical control flow (if/else, while, for)
  • Dynamic circuits with mid-circuit measurements
  • Gate modifiers (ctrl, inv, pow)
  • Type system (qubit, bit, int, float, angle)
  • Subroutine definitions

§Example

use quantrs2_device::qasm3::{Qasm3Builder, Qasm3Circuit};

let mut builder = Qasm3Builder::new(5);
builder.gate("h", &[0])?;
builder.gate("cx", &[0, 1])?;
builder.measure(0, "c", 0)?;
builder.if_statement("c[0] == 1", |b| {
    b.gate("x", &[1])
})?;

let qasm3 = builder.build()?;
println!("{}", qasm3.to_string());

Structs§

Qasm3Builder
Builder for QASM 3.0 circuits
Qasm3Circuit
QASM 3.0 circuit representation
SwitchBuilder
Builder for switch statement cases

Enums§

GateModifier
QASM 3.0 gate modifier
Qasm3Statement
QASM 3.0 statement
Qasm3Type
QASM 3.0 data types

Constants§

QASM3_VERSION
OpenQASM 3.0 version

Functions§

circuit_to_qasm3
Convert a QuantRS2 circuit to QASM 3.0