pub struct ScaledBasis<const N: usize, B> {
pub inner: B,
pub scales: Vec<f64>,
pub center: [f64; N],
}Expand description
Wrapper for any basis that applies coordinate-wise scaling before evaluation.
$V(x) \approx \sum w_i \phi_i(S x)$ where $S$ is a diagonal scaling matrix. Used to map problem domains (e.g. $[0, 100]$) to basis domains (e.g. $[-2, 2]$).
Fields§
§inner: B§scales: Vec<f64>§center: [f64; N]Implementations§
Trait Implementations§
Source§impl<const N: usize, B: Basis<N>> Basis<N> for ScaledBasis<N, B>
impl<const N: usize, B: Basis<N>> Basis<N> for ScaledBasis<N, B>
Source§fn num_features(&self) -> usize
fn num_features(&self) -> usize
Returns the number of basis functions (K).
Source§fn evaluate(&self, state: &[f64; N], buffer: &mut [f64])
fn evaluate(&self, state: &[f64; N], buffer: &mut [f64])
Evaluates all basis functions at
state and writes them into buffer.
buffer must have length at least num_features().Auto Trait Implementations§
impl<const N: usize, B> Freeze for ScaledBasis<N, B>where
B: Freeze,
impl<const N: usize, B> RefUnwindSafe for ScaledBasis<N, B>where
B: RefUnwindSafe,
impl<const N: usize, B> Send for ScaledBasis<N, B>where
B: Send,
impl<const N: usize, B> Sync for ScaledBasis<N, B>where
B: Sync,
impl<const N: usize, B> Unpin for ScaledBasis<N, B>where
B: Unpin,
impl<const N: usize, B> UnsafeUnpin for ScaledBasis<N, B>where
B: UnsafeUnpin,
impl<const N: usize, B> UnwindSafe for ScaledBasis<N, B>where
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more