Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

alexandria_numeric

Fully qualified path: alexandria_numeric

Modules

cumprodThe cumulative product of the elements.
cumsumThe cumulative sum of the elements.
diff
integers
interpolate
trapezoidal_rule

Modules

Modules

cumprodThe cumulative product of the elements.
cumsumThe cumulative sum of the elements.
diff
integers
interpolate
trapezoidal_rule

cumprod

The cumulative product of the elements.

Fully qualified path: alexandria_numeric::cumprod

Free functions

cumprodCompute the cumulative product of a sequence….

Free functions

Free functions

cumprodCompute the cumulative product of a sequence….

cumprod

Compute the cumulative product of a sequence.

Arguments

  • sequence - The sequence to operate.

Returns

  • Array<T> - The cumulative product of sequence.

Fully qualified path: alexandria_numeric::cumprod::cumprod

pub fn cumprod<T, +Mul<T>, +Copy<T>, +Drop<T>>(mut sequence: Span<T>) -> Array<T>

cumsum

The cumulative sum of the elements.

Fully qualified path: alexandria_numeric::cumsum

Free functions

cumsumCompute the cumulative sum of a sequence….

Free functions

Free functions

cumsumCompute the cumulative sum of a sequence….

cumsum

Compute the cumulative sum of a sequence.

Arguments

  • sequence - The sequence to operate.

Returns

  • Array<T> - The cumulative sum of sequence.

Fully qualified path: alexandria_numeric::cumsum::cumsum

pub fn cumsum<T, +Add<T>, +Copy<T>, +Drop<T>>(mut sequence: Span<T>) -> Array<T>

diff

Fully qualified path: alexandria_numeric::diff

Free functions

diffCompute the discrete difference of a sorted sequence….

Free functions

Free functions

diffCompute the discrete difference of a sorted sequence….

diff

Compute the discrete difference of a sorted sequence.

Arguments

  • sequence - The sorted sequence to operate.

Returns

  • Array<T> - The discrete difference of sorted sequence.

Fully qualified path: alexandria_numeric::diff::diff

pub fn diff<T, +PartialOrd<T>, +Sub<T>, +Copy<T>, +Drop<T>, +Zero<T>>(
    mut sequence: Span<T>,
) -> Array<T>

integers

Fully qualified path: alexandria_numeric::integers

Traits

Traits

Traits

UIntBytes

Fully qualified path: alexandria_numeric::integers::UIntBytes

pub trait UIntBytes<T>

Trait functions

from_bytes

Fully qualified path: alexandria_numeric::integers::UIntBytes::from_bytes

fn from_bytes(input: Span<u8>) -> Option<T>

to_bytes

Fully qualified path: alexandria_numeric::integers::UIntBytes::to_bytes

fn to_bytes(self: T) -> Span<u8>

interpolate

Fully qualified path: alexandria_numeric::interpolate

Free functions

interpolateInterpolate y(x) at x….
interpolate_fastFast interpolation function that uses binary search for efficient value lookup. Optimized version of interpolate() with O(log n) time complexity instead of O(n)….

Enums

Free functions

Free functions

interpolateInterpolate y(x) at x….
interpolate_fastFast interpolation function that uses binary search for efficient value lookup. Optimized version of interpolate() with O(log n) time complexity instead of O(n)….

interpolate

Interpolate y(x) at x.

Arguments

  • x - The position at which to interpolate.
  • xs - The sorted abscissa sequence of len L.
  • ys - The ordinate sequence of len L.
  • interpolation - The interpolation method to use.
  • extrapolation - The extrapolation method to use.

Returns

  • T - The interpolated y at x.

Fully qualified path: alexandria_numeric::interpolate::interpolate

pub fn interpolate<
    T, +PartialOrd<T>, +Add<T>, +Sub<T>, +Mul<T>, +Div<T>, +Zero<T>, +Copy<T>, +Drop<T>,
>(
    x: T, xs: Span<T>, ys: Span<T>, interpolation: Interpolation, extrapolation: Extrapolation,
) -> T

interpolate_fast

Fast interpolation function that uses binary search for efficient value lookup. Optimized version of interpolate() with O(log n) time complexity instead of O(n).

Time complexity: O(log n) due to binary search Space complexity: O(1)

Arguments

  • x - The position at which to interpolate
  • xs - The sorted abscissa sequence of length L (must be monotonically increasing)
  • ys - The ordinate sequence of length L corresponding to xs values
  • interpolation - The interpolation method to use (Linear, Nearest, ConstantLeft, ConstantRight)
  • extrapolation - The extrapolation method for values outside xs range (Null, Constant)

Returns

  • T - The interpolated/extrapolated value y at position x

Requirements

  • xs and ys must have the same length
  • xs must be sorted in ascending order
  • Both arrays must have at least 2 elements
  • Type T must implement required arithmetic and comparison traits

Panics

  • If xs and ys have different lengths
  • If arrays have fewer than 2 elements
  • If xs is not properly sorted
  • If binary search fails to find appropriate index

Fully qualified path: alexandria_numeric::interpolate::interpolate_fast

pub fn interpolate_fast<
    T, +PartialOrd<T>, +Add<T>, +Sub<T>, +Mul<T>, +Div<T>, +Zero<T>, +Copy<T>, +Drop<T>,
>(
    x: T, xs: Span<T>, ys: Span<T>, interpolation: Interpolation, extrapolation: Extrapolation,
) -> T

Enums

Enums

Interpolation

Fully qualified path: alexandria_numeric::interpolate::Interpolation

pub enum Interpolation {
    Linear,
    Nearest,
    ConstantLeft,
    ConstantRight,
}

Variants

Linear

Fully qualified path: alexandria_numeric::interpolate::Interpolation::Linear

Linear

Nearest

Fully qualified path: alexandria_numeric::interpolate::Interpolation::Nearest

Nearest

ConstantLeft

Fully qualified path: alexandria_numeric::interpolate::Interpolation::ConstantLeft

ConstantLeft

ConstantRight

Fully qualified path: alexandria_numeric::interpolate::Interpolation::ConstantRight

ConstantRight

Extrapolation

Fully qualified path: alexandria_numeric::interpolate::Extrapolation

pub enum Extrapolation {
    Null,
    Constant,
}

Variants

Null

Fully qualified path: alexandria_numeric::interpolate::Extrapolation::Null

Null

Constant

Fully qualified path: alexandria_numeric::interpolate::Extrapolation::Constant

Constant

trapezoidal_rule

Fully qualified path: alexandria_numeric::trapezoidal_rule

Free functions

trapezoidal_ruleIntegrate y(x)….

Free functions

Free functions

trapezoidal_ruleIntegrate y(x)….

trapezoidal_rule

Integrate y(x).

Arguments

  • xs - The sorted abscissa sequence of len L.
  • ys - The ordinate sequence of len L.

Returns

  • T - The approximate integral.

Fully qualified path: alexandria_numeric::trapezoidal_rule::trapezoidal_rule

pub fn trapezoidal_rule<
    T,
    +PartialOrd<T>,
    +Add<T>,
    +AddAssign<T, T>,
    +Sub<T>,
    +Mul<T>,
    +Div<T>,
    +Copy<T>,
    +Drop<T>,
    +Zero<T>,
    +Into<u8, T>,
>(
    mut xs: Span<T>, mut ys: Span<T>,
) -> T