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§
- Qasm3
Builder - Builder for QASM 3.0 circuits
- Qasm3
Circuit - QASM 3.0 circuit representation
- Switch
Builder - Builder for switch statement cases
Enums§
- Gate
Modifier - QASM 3.0 gate modifier
- Qasm3
Statement - QASM 3.0 statement
- Qasm3
Type - QASM 3.0 data types
Constants§
- QASM3_
VERSION - OpenQASM 3.0 version
Functions§
- circuit_
to_ qasm3 - Convert a QuantRS2 circuit to QASM 3.0