Skip to main content

flip_operator

Function flip_operator 

Source
pub fn flip_operator(
    r: usize,
    bc: BoundaryCondition,
) -> Result<LinearOperator<TensorDynLen, usize>>
Expand description

Create a flip operator: f(x) = g(2^R - x)

This MPO transforms a function g(x) to f(x) = g(2^R - x) for x = 0, 1, …, 2^R - 1.

§Arguments

  • r - Number of bits (sites)
  • bc - Boundary condition (affects behavior at x=0)

§Returns

LinearOperator representing the flip transformation

§Examples

use tensor4all_quanticstransform::{flip_operator, BoundaryCondition};

// Create a flip operator for 4-bit (2^4 = 16 points) quantics representation
let op = flip_operator(4, BoundaryCondition::Periodic).unwrap();

// The operator has one MPO tensor per bit
assert_eq!(op.mpo.node_count(), 4);