std_dev::regression::binary_search

Trait NVariableStorage

source
pub trait NVariableStorage:
    IndexMut<usize, Output = f64>
    + AsRef<[f64]>
    + AsMut<[f64]>
    + Clone {
    type Data;
    type Given<'a>: AsRef<[f64]>
       where Self: 'a;

    // Required methods
    fn new_filled(data: &Self::Data, num: f64) -> Self;
    fn borrow(&self) -> Self::Given<'_>;
}
Available on crate feature regression only.
Expand description

A trait which allows storage of n-variable optimization, either on the stack through arrays ([f64; VARIABLE_COUNT]) or allocated on the heap through Vec.

Required Associated Types§

source

type Data

Associated data for use in construction of this type. The number of arguments in case of using a Vec, nothing when using arrays, as we know their length in compile time.

source

type Given<'a>: AsRef<[f64]> where Self: 'a

The structure that’s given to the fitness function. Needs to have the same length as the .as_ref() implementation of this struct.

Required Methods§

source

fn new_filled(data: &Self::Data, num: f64) -> Self

Creates a new storage filled with num.

source

fn borrow(&self) -> Self::Given<'_>

Borrow the current variables.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

source§

impl NVariableStorage for Vec<f64>

source§

type Data = VariableLengthStorage

source§

type Given<'a> = &'a [f64]

source§

fn new_filled(data: &Self::Data, num: f64) -> Self

source§

fn borrow(&self) -> Self::Given<'_>

source§

impl<const LENGTH: usize> NVariableStorage for [f64; LENGTH]

source§

type Data = ()

source§

type Given<'a> = [f64; LENGTH]

source§

fn new_filled(_data: &(), num: f64) -> Self

source§

fn borrow(&self) -> Self::Given<'_>

Implementors§