Skip to main content

ScaleInPlace

Trait ScaleInPlace 

Source
pub trait ScaleInPlace<F = f64> {
    // Required method
    fn scale_in_place(&mut self, scalar: F);
}
Expand description

In-place scalar multiplication self ← scalar · self. Used by CMA-ES to update the cumulation paths (p_σ ← (1−c_σ) p_σ + …, Hansen 2016 eq. 31) and the covariance matrix (C ← (1 + c_1 δ_h − c_1 − c_µ Σ w_j) C + …, eq. 47) without allocating a clone per iteration.

ScaledAdd<f64> already covers self ← self + s · other; the borrow checker forbids self.scaled_add(s, &self), so an honest in-place scale needs its own trait.

F defaults to f64; see NormSquared for the rationale.

Required Methods§

Source

fn scale_in_place(&mut self, scalar: F)

Multiply every component of self by scalar in place.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<F, R, C, S> ScaleInPlace<F> for Matrix<F, R, C, S>
where F: Scalar, R: Dim, C: Dim, S: StorageMut<F, R, C>,

Available on crate feature nalgebra only.
Source§

fn scale_in_place(&mut self, scalar: F)

Source§

impl<F, S, D> ScaleInPlace<F> for ArrayBase<S, D>
where F: Scalar, S: DataMut<Elem = F>, D: Dimension,

Available on crate feature ndarray only.
Source§

fn scale_in_place(&mut self, scalar: F)

Source§

impl<F: Scalar> ScaleInPlace<F> for Col<F>

Available on crate feature faer only.
Source§

fn scale_in_place(&mut self, scalar: F)

Source§

impl<F: Scalar> ScaleInPlace<F> for Mat<F>

Available on crate feature faer only.
Source§

fn scale_in_place(&mut self, scalar: F)

Source§

impl<F: Scalar> ScaleInPlace<F> for Vec<F>

Source§

fn scale_in_place(&mut self, scalar: F)

Implementors§