[][src]Trait nshare::ToNdarray1

pub trait ToNdarray1 {
    type Out;
    fn to_ndarray1(self) -> Self::Out;
}

Converts 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.

Associated Types

type Out

Loading content...

Required methods

fn to_ndarray1(self) -> Self::Out

Loading content...

Implementations on Foreign Types

impl<'a, N: Scalar, R: Dim, RStride: Dim, CStride: Dim> ToNdarray1 for Vector<N, R, SliceStorage<'a, N, R, U1, RStride, CStride>>[src]

use nshare::ToNdarray1;
use nalgebra::Vector4;

let m = Vector4::new(
    0.1, 0.2, 0.3, 0.4f32,
);
let arr = m.rows(0, 4).to_ndarray1();
assert!(arr.iter().eq(&[0.1, 0.2, 0.3, 0.4]));
assert_eq!(arr.dim(), 4);

type Out = ArrayView1<'a, N>

impl<'a, N: Scalar, R: Dim, RStride: Dim, CStride: Dim> ToNdarray1 for Matrix<N, R, U1, SliceStorageMut<'a, N, R, U1, RStride, CStride>>[src]

use nshare::ToNdarray1;
use nalgebra::{Vector4, dimension::U2};

let mut m = Vector4::new(
    0.1, 0.2, 0.3, 0.4,
);
let arr = m.rows_generic_with_step_mut::<U2>(0, U2, 1).to_ndarray1().fill(0.0);
assert!(m.iter().eq(&[0.0, 0.2, 0.0, 0.4]));

type Out = ArrayViewMut1<'a, N>

impl<'a, N: Scalar> ToNdarray1 for DVector<N>[src]

use nshare::ToNdarray1;
use nalgebra::DVector;
use ndarray::s;

let m = DVector::from_vec(vec![
    0.1, 0.2, 0.3, 0.4,
]);
let arr = m.to_ndarray1();
assert_eq!(arr.dim(), 4);
assert!(arr.iter().eq(&[0.1, 0.2, 0.3, 0.4]));

type Out = Array1<N>

Loading content...

Implementors

Loading content...