quantrs2-circuit 0.1.3

Quantum circuit representation and DSL for the QuantRS2 framework
Documentation
//! Auto-generated module
//!
//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)

use quantrs2_core::{
    error::{QuantRS2Error, QuantRS2Result},
    gate::GateOp,
    qubit::QubitId,
    register::Register,
};

use super::enhancedqasmcompiler_type::EnhancedQASMCompiler;
use super::types::{EnhancedQASMConfig, OptimizationLevel, QASMVersion, AST};

pub(super) type NodeId = usize;
/// Optimization model trait
pub(super) trait OptimizationModel: Send + Sync {
    fn optimize(&self, ast: &AST) -> QuantRS2Result<AST>;
    fn predict_improvement(&self, ast: &AST) -> f64;
}
#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_enhanced_qasm_compiler_creation() {
        let config = EnhancedQASMConfig::default();
        let compiler = EnhancedQASMCompiler::new(config);
        assert!(compiler.ml_optimizer.is_some());
    }
    #[test]
    fn test_qasm_version_detection() {
        let config = EnhancedQASMConfig::default();
        let _compiler = EnhancedQASMCompiler::new(config);
        assert_eq!(
            EnhancedQASMCompiler::detect_version("OPENQASM 3.0;")
                .expect("Failed to detect QASM 3.0 version"),
            QASMVersion::QASM3
        );
        assert_eq!(
            EnhancedQASMCompiler::detect_version("OPENQASM 2.0;")
                .expect("Failed to detect QASM 2.0 version"),
            QASMVersion::QASM2
        );
    }
    #[test]
    fn test_default_configuration() {
        let config = EnhancedQASMConfig::default();
        assert_eq!(config.optimization_level, OptimizationLevel::Aggressive);
        assert!(config.enable_ml_optimization);
        assert!(config.enable_semantic_analysis);
    }
}