Skip to main content

OdeEnsemble

Struct OdeEnsemble 

Source
pub struct OdeEnsemble { /* private fields */ }
Expand description

A batch of N lane outcomes, in the same order as the lanes handed in.

Lane i of the result corresponds to lanes[i], always — the parallel path preserves order, so no index bookkeeping is needed.

§Getting states out

§Units

See OdeLaneSolution.

Implementations§

Source§

impl OdeEnsemble

Source

pub fn lanes(&self) -> &[OdeLaneSolution]

Every lane’s outcome, in input order.

Source

pub fn into_lanes(self) -> Vec<OdeLaneSolution>

Consume the ensemble and take the outcomes.

Source

pub fn len(&self) -> usize

Number of lanes, dimensionless.

Source

pub fn is_empty(&self) -> bool

Whether the ensemble has no lanes.

Source

pub fn get(&self, i: usize) -> Option<&OdeLaneSolution>

Lane i’s outcome, or None if i is out of range.

Source

pub fn all_completed(&self) -> bool

Whether every lane completed. Vacuously true for an empty ensemble.

Source

pub fn failure_count(&self) -> usize

How many lanes failed, dimensionless.

Source

pub fn first_failure(&self) -> Option<(usize, &OdeLaneSolution)>

The first failing lane’s index and outcome, if any.

The natural thing to print when an ensemble fails: it names the cell to look at rather than just the count.

Source

pub fn failures(&self) -> Vec<(usize, &OdeLaneSolution)>

Every failing lane, as (index, outcome) pairs.

Allocates, so prefer Self::first_failure or Self::failure_count on a hot path.

Source

pub fn total_steps(&self) -> u64

Total accepted sub-steps over every lane, dimensionless.

The honest measure of how much work the ensemble did, and — read beside Self::max_steps_taken — the measure of how imbalanced it was.

Source

pub fn max_steps_taken(&self) -> u32

The largest accepted-sub-step count over all lanes, dimensionless; 0 for an empty ensemble.

With Self::total_steps this quantifies the load imbalance the module-level “Load imbalance” section describes: a maximum far above the mean is precisely the case that makes work-stealing worth having.

Source

pub fn states(&self) -> Result<Vec<Vec<f64>>, OdeEnsembleFailure>

Every lane’s final state, or an error naming the failures — the all-or-nothing path.

§Returns

Ok(v) with v[i] the final state of lane i, in that lane’s own units, when every lane completed. Otherwise Err(OdeEnsembleFailure) carrying the failure count and the first failing lane. No Vec of plausible-looking states is ever returned for an ensemble that contained a failure.

An empty ensemble returns Ok(vec![]).

§Errors

OdeEnsembleFailure when one or more lanes did not complete.

Source

pub fn into_states(self) -> Result<Vec<Vec<f64>>, OdeEnsembleFailure>

Self::states without the clone — consumes the ensemble.

§Errors

OdeEnsembleFailure when one or more lanes did not complete.

Trait Implementations§

Source§

impl Clone for OdeEnsemble

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 OdeEnsemble

Source§

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

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

impl PartialEq for OdeEnsemble

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 OdeEnsemble

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.