Skip to main content

shift_operator

Function shift_operator 

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

Create a shift operator: f(x) = g(x + offset) mod 2^R

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

§Arguments

  • r - Number of bits (sites)
  • offset - Shift amount (can be negative)
  • bc - Boundary condition

§Returns

LinearOperator representing the shift transformation

§Examples

use tensor4all_quanticstransform::{shift_operator, BoundaryCondition};

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

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