pub struct SimdBatchProcessor;Expand description
SIMD-accelerated batch operations for numeric data.
This processor uses SIMD (Single Instruction, Multiple Data) instructions to accelerate common numeric operations on large datasets. Operations process 4 f64 values simultaneously, providing significant performance improvements for large-scale simulations.
§Examples
use legalis_sim::SimdBatchProcessor;
// Compute statistics on a large dataset
let data: Vec<f64> = (1..=1000).map(|x| x as f64).collect();
let sum = SimdBatchProcessor::sum_f64(&data);
let mean = SimdBatchProcessor::mean_f64(&data).unwrap();
let std_dev = SimdBatchProcessor::std_dev_f64(&data).unwrap();
assert_eq!(sum, 500500.0);
assert!((mean - 500.5).abs() < 0.01);
assert!(std_dev > 0.0);Implementations§
Source§impl SimdBatchProcessor
impl SimdBatchProcessor
Sourcepub fn sum_f64(values: &[f64]) -> f64
pub fn sum_f64(values: &[f64]) -> f64
Computes sum of f64 values using SIMD acceleration.
Processes values in batches of 4 using SIMD instructions for improved performance.
§Examples
use legalis_sim::SimdBatchProcessor;
let values = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let sum = SimdBatchProcessor::sum_f64(&values);
assert_eq!(sum, 15.0);Sourcepub fn mean_f64(values: &[f64]) -> Option<f64>
pub fn mean_f64(values: &[f64]) -> Option<f64>
Computes mean of f64 values using SIMD acceleration.
Returns None if the input slice is empty.
§Examples
use legalis_sim::SimdBatchProcessor;
let values = vec![2.0, 4.0, 6.0, 8.0, 10.0];
let mean = SimdBatchProcessor::mean_f64(&values).unwrap();
assert_eq!(mean, 6.0);Sourcepub fn variance_f64(values: &[f64]) -> Option<f64>
pub fn variance_f64(values: &[f64]) -> Option<f64>
Computes variance of f64 values using SIMD acceleration
Sourcepub fn std_dev_f64(values: &[f64]) -> Option<f64>
pub fn std_dev_f64(values: &[f64]) -> Option<f64>
Computes standard deviation using SIMD acceleration
Sourcepub fn scale_f64(values: &mut [f64], scalar: f64)
pub fn scale_f64(values: &mut [f64], scalar: f64)
Applies scalar multiplication using SIMD acceleration
Sourcepub fn dot_product_f64(a: &[f64], b: &[f64]) -> Option<f64>
pub fn dot_product_f64(a: &[f64], b: &[f64]) -> Option<f64>
Computes dot product of two vectors using SIMD acceleration
Sourcepub fn normalize_f64(values: &mut [f64]) -> Option<()>
pub fn normalize_f64(values: &mut [f64]) -> Option<()>
Normalizes values to [0, 1] range using SIMD acceleration