lead_float

Function lead_float 

Source
pub fn lead_float<T: Copy + Zero>(
    window: FloatAVT<'_, T>,
    n: usize,
) -> FloatArray<T>
Expand description

Accesses values from future positions in floating-point arrays with IEEE 754 compliance.

Implements SQL LEAD() function for floating-point data, retrieving values from later positions while preserving IEEE 754 semantics. Essential for forward-looking analysis and predictive modeling with continuous numerical data.

§Parameters

  • window - Float array view containing sequential floating-point data
  • n - Lead offset specifying forward position distance

§Returns

Returns a FloatArray<T> containing:

  • Floating-point values from n positions later
  • Zero values for positions beyond available future
  • Null mask indicating lead validity and special value propagation

§Use Cases

  • Predictive analytics: Accessing future values for comparison and modeling
  • Signal analysis: Forward-looking operations in digital signal processing
  • Financial modeling: Computing forward returns and future value analysis
  • Scientific computing: Implementing forward difference schemes

§Examples

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

let arr = FloatArray::<f32>::from_slice(&[1.1, 2.2, 3.3, 4.4]);
let result = lead_float((&arr, 0, arr.len()), 2);
// Output: [3.3, 4.4, 0.0, 0.0] - lead by 2 positions