pub fn phase_rotation_operator_multivar(
r: usize,
theta: f64,
nvariables: usize,
target_var: usize,
) -> Result<LinearOperator<TensorDynLen, usize>>Expand description
Create a phase rotation operator for one variable in a multi-variable system.
Acts as phase rotation on target_var and identity on all other variables.
The resulting operator works on interleaved quantics encoding where each
site has local dimension 2^nvariables.
§Arguments
r- Number of bits (sites)theta- Phase angle in radiansnvariables- Total number of variablestarget_var- Which variable to apply phase rotation to (0-indexed)
§Examples
use tensor4all_quanticstransform::phase_rotation_operator_multivar;
use std::f64::consts::PI;
// Phase rotate only the x-variable of a 2-variable function f(x, y)
let op = phase_rotation_operator_multivar(4, PI / 4.0, 2, 0).unwrap();
assert_eq!(op.mpo.node_count(), 4);