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§
Sourcefn scale_in_place(&mut self, scalar: F)
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>
Available on crate feature nalgebra only.
impl<F, R, C, S> ScaleInPlace<F> for Matrix<F, R, C, S>
Available on crate feature
nalgebra only.fn scale_in_place(&mut self, scalar: F)
Source§impl<F, S, D> ScaleInPlace<F> for ArrayBase<S, D>
Available on crate feature ndarray only.
impl<F, S, D> ScaleInPlace<F> for ArrayBase<S, D>
Available on crate feature
ndarray only.fn scale_in_place(&mut self, scalar: F)
Source§impl<F: Scalar> ScaleInPlace<F> for Col<F>
Available on crate feature faer only.
impl<F: Scalar> ScaleInPlace<F> for Col<F>
Available on crate feature
faer only.fn scale_in_place(&mut self, scalar: F)
Source§impl<F: Scalar> ScaleInPlace<F> for Mat<F>
Available on crate feature faer only.
impl<F: Scalar> ScaleInPlace<F> for Mat<F>
Available on crate feature
faer only.