Expand description
Symbolic and numeric parameter type for quantum circuit gate angles.
Parameter wraps a symb_anafis::Expr expression tree, allowing gate parameters
to be either concrete floating-point numbers or symbolic expressions containing
free variables (e.g. θ, φ). Symbolic parameters can be composed with
arithmetic operators, differentiated, simplified, and finally evaluated by
supplying variable bindings.
§Quick start
use cqlib_core::circuit::Parameter;
// Numeric parameter
let angle = Parameter::from(std::f64::consts::PI / 2.0);
// Symbolic parameter
let theta = Parameter::symbol("θ");
let expr = theta.clone() * Parameter::from(2.0) + Parameter::pi();
// Evaluate with a concrete binding
let val = expr.evaluate(&Some([("θ", 0.5)].iter().cloned().collect())).unwrap();Structs§
- Parameter
- A symbolic or numeric parameter used to represent gate angles and other continuous values in a quantum circuit.