pub trait MutNdarray1 {
type Out;
// Required method
fn mut_ndarray1(self) -> Self::Out;
}
Expand description
Mutably borrows a 1d type to a ndarray 1d array type.
This uses an associated type to avoid ambiguity for the compiler. By calling this, the compiler always knows the returned type.
Required Associated Types§
Required Methods§
fn mut_ndarray1(self) -> Self::Out
Implementations on Foreign Types§
Source§impl<'a, N: Scalar, R: Dim, S> MutNdarray1 for &'a mut Vector<N, R, S>where
S: StorageMut<N, R, U1>,
use nalgebra::Vector4;
use ndarray::s;
use nshare::MutNdarray1;
let mut m = Vector4::new(0.1, 0.2, 0.3, 0.4f32);
// Set everything to 0.
m.mut_ndarray1().fill(0.0);
assert!(m.iter().eq(&[0.0; 4]));
impl<'a, N: Scalar, R: Dim, S> MutNdarray1 for &'a mut Vector<N, R, S>where
S: StorageMut<N, R, U1>,
use nalgebra::Vector4;
use ndarray::s;
use nshare::MutNdarray1;
let mut m = Vector4::new(0.1, 0.2, 0.3, 0.4f32);
// Set everything to 0.
m.mut_ndarray1().fill(0.0);
assert!(m.iter().eq(&[0.0; 4]));