Skip to main content

Axis

Struct Axis 

Source
pub struct Axis { /* private fields */ }

Implementations§

Source§

impl Axis

Source

pub fn from_values(values: Vec<f64>) -> Result<Self, ErrorsJSL>

An axis on arbitrary increasing samples with trapezoid weights over [first, last].

Source

pub fn uniform(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>

n >= 2 uniform samples from start to end inclusive, trapezoid weights.

Source

pub fn simpson(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>

Uniform samples with composite Simpson weights (n odd, at least 3).

Source

pub fn periodic(offset: f64, period: f64, n: usize) -> Result<Self, ErrorsJSL>

n uniform samples covering one period [offset, offset + period) (the end point is the start point again, so it is not repeated).

Source

pub fn periodic_from_values( values: Vec<f64>, period: f64, ) -> Result<Self, ErrorsJSL>

Non-uniform samples within one period (trapezoid weights including the wrap-around gap).

Source

pub fn gauss_legendre(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>

n Gauss-Legendre nodes on [start, end].

Source

pub fn gauss_legendre_polar(n: usize) -> Result<Self, ErrorsJSL>

A polar (θ) axis on (0, π) with Gauss-Legendre nodes in cos θ; see QuadratureRule::GaussLegendrePolar. Exact on the sphere for polynomials in cos θ of degree up to 2n - 1, and it never samples the poles.

Source

pub fn values(&self) -> &[f64]

Source

pub fn weights(&self) -> &[f64]

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn period(&self) -> Option<f64>

Source

pub fn is_periodic(&self) -> bool

Source

pub fn rule(&self) -> QuadratureRule

Source

pub fn first(&self) -> f64

Source

pub fn last(&self) -> f64

Source

pub fn is_uniform(&self) -> bool

Whether every gap between samples (including the wrap gap on periodic axes) is equal.

Source

pub fn wrap_index(&self, i: isize) -> Option<usize>

Maps a possibly out-of-range index to a valid one: wrapping on periodic axes, None beyond the ends otherwise.

Source

pub fn reduce(&self, u: f64) -> f64

Reduces a coordinate into the axis’s period (for periodic axes), starting at the first sample.

Source

pub fn locate(&self, u: f64) -> Option<(usize, f64)>

The cell containing u: index i and fraction t in [0, 1] such that u = values[i] + t (values[i+1] - values[i]) (the “next” sample wraps on periodic axes). None outside a non-periodic axis’s range (inclusive of the end points), or for a single-sample non-periodic axis unless u equals the sample.

Source

pub fn nearest(&self, u: f64) -> usize

The index of the sample closest to u (wrapping on periodic axes; clamped otherwise).

Source

pub fn measure(&self) -> f64

The sum of the weights: the length the rule integrates over.

Trait Implementations§

Source§

impl Clone for Axis

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Axis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Axis

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Axis

Auto Trait Implementations§

§

impl Freeze for Axis

§

impl RefUnwindSafe for Axis

§

impl Send for Axis

§

impl Sync for Axis

§

impl Unpin for Axis

§

impl UnsafeUnpin for Axis

§

impl UnwindSafe for Axis

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.