Struct SimdOps

Source
#[repr(align(32))]
pub struct SimdOps;
Expand description

SIMD-accelerated operations optimized for HFT market data processing

Provides safe, portable SIMD implementations of common numerical operations used in high-frequency trading applications. All operations use the wide crate for guaranteed safety and cross-platform compatibility.

§Design Principles

  • Safety first: Zero unsafe code, guaranteed memory safety
  • Portability: Works across x86_64, ARM, and other architectures
  • Performance: 2-4x speedup through SIMD vectorization
  • Simplicity: Clean API that abstracts SIMD complexity

§Cache Alignment

32-byte alignment ensures optimal AVX/AVX2 performance and prevents cache line splits that could degrade SIMD operation efficiency.

Implementations§

Source§

impl SimdOps

Source

pub fn min_f64(values: &[f64]) -> f64

Apply SIMD-accelerated min to an array of f64 values Uses safe portable SIMD operations

Source

pub fn max_f64(values: &[f64]) -> f64

Apply SIMD-accelerated max to an array of f64 values Uses safe portable SIMD operations

Source

pub fn sum_f64(values: &[f64]) -> f64

Apply SIMD-accelerated sum to an array of f64 values Uses safe portable SIMD operations

Source

pub fn avg_f64(values: &[f64]) -> f64

Apply SIMD-accelerated average to an array of f64 values Uses safe portable SIMD operations

Source

pub fn weighted_avg_f64(values: &[f64], weights: &[f64]) -> f64

Apply SIMD-accelerated weighted average to arrays of values and weights Uses safe portable SIMD operations

Source

pub fn convert_to_f64<T: Into<f64> + Copy>(values: &[T]) -> Vec<f64>

Convert an array of decimal prices to f64 for SIMD operations

Source

pub const fn avx2_supported() -> bool

Check if AVX2 is supported at runtime Kept for backward compatibility but no longer needed with portable SIMD

Source

pub fn min_f64_aligned(values: &[f64]) -> f64

Apply SIMD-accelerated min using simd_aligned containers for optimal memory alignment This version ensures data is properly aligned for SIMD operations and uses thread-local buffers

Source

pub fn max_f64_aligned(values: &[f64]) -> f64

Apply SIMD-accelerated max using simd_aligned containers for optimal memory alignment This version uses thread-local buffers to avoid repeated allocations

Source

pub fn sum_f64_aligned(values: &[f64]) -> f64

Apply SIMD-accelerated sum using simd_aligned containers This version uses thread-local buffers to avoid repeated allocations

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,