shift_float

Function shift_float 

Source
pub fn shift_float<T: Copy + Zero>(
    window: FloatAVT<'_, T>,
    offset: isize,
) -> FloatArray<T>
Expand description

Shifts floating-point array elements with IEEE 754 compliance and bidirectional support.

Unified shifting interface for floating-point data supporting both LAG and LEAD semantics through signed offset parameter. Maintains IEEE 754 standards for special value handling while providing efficient bidirectional positional access.

§Parameters

  • window - Float array view containing data for shifting
  • offset - Signed offset: positive for LEAD (forward), negative for LAG (backward), zero for identity

§Returns

Returns a FloatArray<T> containing:

  • Shifted floating-point values preserving IEEE 754 semantics
  • Zero values for positions beyond data boundaries
  • Null mask indicating validity of shifted positions

§Examples

use minarrow::FloatArray;
use simd_kernels::kernels::window::shift_float;

let arr = FloatArray::<f64>::from_slice(&[1.1, 2.2, 3.3, 4.4]);
let backward = shift_float((&arr, 0, arr.len()), -2); // LAG by 2
let forward = shift_float((&arr, 0, arr.len()), 1);   // LEAD by 1