Type Definition nalgebra::base::MatrixMN[][src]

type MatrixMN<N, R, C> = Matrix<N, R, C, Owned<N, R, C>>;

A statically sized column-major matrix with R rows and C columns.

Because this is an alias, not all its methods are listed here. See the Matrix type too.

Implementations

impl<N: Scalar, R: Dim, C: Dim> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

Generic constructors

This set of matrix and vector construction functions are all generic with-regard to the matrix dimensions. They all expect to be given the dimension as inputs.

These functions should only be used when working on dimension-generic code.

pub unsafe fn new_uninitialized_generic(nrows: R, ncols: C) -> Self[src]

Creates a new uninitialized matrix. If the matrix has a compile-time dimension, this panics if nrows != R::to_usize() or ncols != C::to_usize().

pub fn from_element_generic(nrows: R, ncols: C, elem: N) -> Self[src]

Creates a matrix with all its elements set to elem.

pub fn repeat_generic(nrows: R, ncols: C, elem: N) -> Self[src]

Creates a matrix with all its elements set to elem.

Same as from_element_generic.

pub fn zeros_generic(nrows: R, ncols: C) -> Self where
    N: Zero
[src]

Creates a matrix with all its elements set to 0.

pub fn from_iterator_generic<I>(nrows: R, ncols: C, iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

Creates a matrix with all its elements filled by an iterator.

pub fn from_row_slice_generic(nrows: R, ncols: C, slice: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in row-major order.

The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.

pub fn from_column_slice_generic(nrows: R, ncols: C, slice: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice. The components must have the same layout as the matrix data storage (i.e. column-major).

pub fn from_fn_generic<F>(nrows: R, ncols: C, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

Creates a matrix filled with the results of a function applied to each of its component coordinates.

pub fn identity_generic(nrows: R, ncols: C) -> Self where
    N: Zero + One
[src]

Creates a new identity matrix.

If the matrix is not square, the largest square submatrix starting at index (0, 0) is set to the identity matrix. All other entries are set to zero.

pub fn from_diagonal_element_generic(nrows: R, ncols: C, elt: N) -> Self where
    N: Zero + One
[src]

Creates a new matrix with its diagonal filled with copies of elt.

If the matrix is not square, the largest square submatrix starting at index (0, 0) is set to the identity matrix. All other entries are set to zero.

pub fn from_partial_diagonal_generic(nrows: R, ncols: C, elts: &[N]) -> Self where
    N: Zero
[src]

Creates a new matrix that may be rectangular. The first elts.len() diagonal elements are filled with the content of elts. Others are set to 0.

Panics if elts.len() is larger than the minimum among nrows and ncols.

pub fn from_rows<SB>(rows: &[Matrix<N, U1, C, SB>]) -> Self where
    SB: Storage<N, U1, C>, 
[src]

Builds a new matrix from its rows.

Panics if not enough rows are provided (for statically-sized matrices), or if all rows do not have the same dimensions.

Example


let m = Matrix3::from_rows(&[ RowVector3::new(1.0, 2.0, 3.0),  RowVector3::new(4.0, 5.0, 6.0),  RowVector3::new(7.0, 8.0, 9.0) ]);

assert!(m.m11 == 1.0 && m.m12 == 2.0 && m.m13 == 3.0 &&
        m.m21 == 4.0 && m.m22 == 5.0 && m.m23 == 6.0 &&
        m.m31 == 7.0 && m.m32 == 8.0 && m.m33 == 9.0);

pub fn from_columns<SB>(columns: &[Vector<N, R, SB>]) -> Self where
    SB: Storage<N, R>, 
[src]

Builds a new matrix from its columns.

Panics if not enough columns are provided (for statically-sized matrices), or if all columns do not have the same dimensions.

Example


let m = Matrix3::from_columns(&[ Vector3::new(1.0, 2.0, 3.0),  Vector3::new(4.0, 5.0, 6.0),  Vector3::new(7.0, 8.0, 9.0) ]);

assert!(m.m11 == 1.0 && m.m12 == 4.0 && m.m13 == 7.0 &&
        m.m21 == 2.0 && m.m22 == 5.0 && m.m23 == 8.0 &&
        m.m31 == 3.0 && m.m32 == 6.0 && m.m33 == 9.0);

pub fn new_random_generic(nrows: R, ncols: C) -> Self where
    Standard: Distribution<N>, 
[src]

Creates a matrix filled with random values.

pub fn from_distribution_generic<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    nrows: R,
    ncols: C,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix filled with random values from the given distribution.

pub fn from_vec_generic(nrows: R, ncols: C, data: Vec<N>) -> Self[src]

Creates a matrix backed by a given Vec.

The output matrix is filled column-by-column.

Example


let vec = vec![0, 1, 2, 3, 4, 5];
let vec_ptr = vec.as_ptr();

let matrix = Matrix::from_vec_generic(Dynamic::new(vec.len()), U1, vec);
let matrix_storage_ptr = matrix.data.as_vec().as_ptr();

// `matrix` is backed by exactly the same `Vec` as it was constructed from.
assert_eq!(matrix_storage_ptr, vec_ptr);

impl<N: Scalar, R: DimName, C: DimName> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

pub unsafe fn new_uninitialized() -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Example


let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn repeat(elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Same as .from_element.

Example


let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn zeros() -> Self where
    N: Zero
[src]

Creates a matrix or vector with all its elements set to 0.

Example


let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);

assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);

pub fn from_iterator<I>(iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

Creates a matrix or vector with all its elements filled by an iterator.

The output matrix is filled column-by-column.

Example


let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_fn<F>(f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.

Example


let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn identity() -> Self where
    N: Zero + One
[src]

Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.

Example


let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);

pub fn from_diagonal_element(elt: N) -> Self where
    N: Zero + One
[src]

Creates a matrix filled with its diagonal filled with elt and all other components set to zero.

Example


let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);

assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);

pub fn from_partial_diagonal(elts: &[N]) -> Self where
    N: Zero
[src]

Creates a new matrix that may be rectangular. The first elts.len() diagonal elements are filled with the content of elts. Others are set to 0.

Panics if elts.len() is larger than the minimum among nrows and ncols.

Example


let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
        m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
        dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

pub fn new_random() -> Self where
    Standard: Distribution<N>, 
[src]

Creates a matrix filled with random values.

impl<N: Scalar, R: DimName> MatrixMN<N, R, Dynamic> where
    DefaultAllocator: Allocator<N, R, Dynamic>, 
[src]

pub unsafe fn new_uninitialized(ncols: usize) -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(ncols: usize, elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Example


let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn repeat(ncols: usize, elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Same as .from_element.

Example


let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn zeros(ncols: usize) -> Self where
    N: Zero
[src]

Creates a matrix or vector with all its elements set to 0.

Example


let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);

assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);

pub fn from_iterator<I>(ncols: usize, iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

Creates a matrix or vector with all its elements filled by an iterator.

The output matrix is filled column-by-column.

Example


let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_fn<F>(ncols: usize, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.

Example


let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn identity(ncols: usize) -> Self where
    N: Zero + One
[src]

Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.

Example


let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);

pub fn from_diagonal_element(ncols: usize, elt: N) -> Self where
    N: Zero + One
[src]

Creates a matrix filled with its diagonal filled with elt and all other components set to zero.

Example


let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);

assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);

pub fn from_partial_diagonal(ncols: usize, elts: &[N]) -> Self where
    N: Zero
[src]

Creates a new matrix that may be rectangular. The first elts.len() diagonal elements are filled with the content of elts. Others are set to 0.

Panics if elts.len() is larger than the minimum among nrows and ncols.

Example


let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
        m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
        dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    ncols: usize,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

pub fn new_random(ncols: usize) -> Self where
    Standard: Distribution<N>, 
[src]

Creates a matrix filled with random values.

impl<N: Scalar, C: DimName> MatrixMN<N, Dynamic, C> where
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

pub unsafe fn new_uninitialized(nrows: usize) -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(nrows: usize, elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Example


let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn repeat(nrows: usize, elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Same as .from_element.

Example


let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn zeros(nrows: usize) -> Self where
    N: Zero
[src]

Creates a matrix or vector with all its elements set to 0.

Example


let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);

assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);

pub fn from_iterator<I>(nrows: usize, iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

Creates a matrix or vector with all its elements filled by an iterator.

The output matrix is filled column-by-column.

Example


let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_fn<F>(nrows: usize, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.

Example


let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn identity(nrows: usize) -> Self where
    N: Zero + One
[src]

Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.

Example


let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);

pub fn from_diagonal_element(nrows: usize, elt: N) -> Self where
    N: Zero + One
[src]

Creates a matrix filled with its diagonal filled with elt and all other components set to zero.

Example


let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);

assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);

pub fn from_partial_diagonal(nrows: usize, elts: &[N]) -> Self where
    N: Zero
[src]

Creates a new matrix that may be rectangular. The first elts.len() diagonal elements are filled with the content of elts. Others are set to 0.

Panics if elts.len() is larger than the minimum among nrows and ncols.

Example


let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
        m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
        dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    nrows: usize,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

pub fn new_random(nrows: usize) -> Self where
    Standard: Distribution<N>, 
[src]

Creates a matrix filled with random values.

impl<N: Scalar> MatrixMN<N, Dynamic, Dynamic> where
    DefaultAllocator: Allocator<N, Dynamic, Dynamic>, 
[src]

pub unsafe fn new_uninitialized(nrows: usize, ncols: usize) -> Self[src]

Creates a new uninitialized matrix or vector.

pub fn from_element(nrows: usize, ncols: usize, elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Example


let v = Vector3::from_element(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::from_element(3, 2.0);
let m = Matrix2x3::from_element(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_element(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn repeat(nrows: usize, ncols: usize, elem: N) -> Self[src]

Creates a matrix or vector with all its elements set to elem.

Same as .from_element.

Example


let v = Vector3::repeat(2.0);
// The additional argument represents the vector dimension.
let dv = DVector::repeat(3, 2.0);
let m = Matrix2x3::repeat(2.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::repeat(2, 3, 2.0);

assert!(v.x == 2.0 && v.y == 2.0 && v.z == 2.0);
assert!(dv[0] == 2.0 && dv[1] == 2.0 && dv[2] == 2.0);
assert!(m.m11 == 2.0 && m.m12 == 2.0 && m.m13 == 2.0 &&
        m.m21 == 2.0 && m.m22 == 2.0 && m.m23 == 2.0);
assert!(dm[(0, 0)] == 2.0 && dm[(0, 1)] == 2.0 && dm[(0, 2)] == 2.0 &&
        dm[(1, 0)] == 2.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 2.0);

pub fn zeros(nrows: usize, ncols: usize) -> Self where
    N: Zero
[src]

Creates a matrix or vector with all its elements set to 0.

Example


let v = Vector3::<f32>::zeros();
// The argument represents the vector dimension.
let dv = DVector::<f32>::zeros(3);
let m = Matrix2x3::<f32>::zeros();
// The two arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::zeros(2, 3);

assert!(v.x == 0.0 && v.y == 0.0 && v.z == 0.0);
assert!(dv[0] == 0.0 && dv[1] == 0.0 && dv[2] == 0.0);
assert!(m.m11 == 0.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 0.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 0.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 0.0 && dm[(1, 2)] == 0.0);

pub fn from_iterator<I>(nrows: usize, ncols: usize, iter: I) -> Self where
    I: IntoIterator<Item = N>, 
[src]

Creates a matrix or vector with all its elements filled by an iterator.

The output matrix is filled column-by-column.

Example


let v = Vector3::from_iterator((0..3).into_iter());
// The additional argument represents the vector dimension.
let dv = DVector::from_iterator(3, (0..3).into_iter());
let m = Matrix2x3::from_iterator((0..6).into_iter());
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_iterator(2, 3, (0..6).into_iter());

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_fn<F>(nrows: usize, ncols: usize, f: F) -> Self where
    F: FnMut(usize, usize) -> N, 
[src]

Creates a matrix or vector filled with the results of a function applied to each of its component coordinates.

Example


let v = Vector3::from_fn(|i, _| i);
// The additional argument represents the vector dimension.
let dv = DVector::from_fn(3, |i, _| i);
let m = Matrix2x3::from_fn(|i, j| i * 3 + j);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_fn(2, 3, |i, j| i * 3 + j);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn identity(nrows: usize, ncols: usize) -> Self where
    N: Zero + One
[src]

Creates an identity matrix. If the matrix is not square, the largest square submatrix (starting at the first row and column) is set to the identity while all other entries are set to zero.

Example


let m = Matrix2x3::<f32>::identity();
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::<f32>::identity(2, 3);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 1.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 1.0 && dm[(1, 2)] == 0.0);

pub fn from_diagonal_element(nrows: usize, ncols: usize, elt: N) -> Self where
    N: Zero + One
[src]

Creates a matrix filled with its diagonal filled with elt and all other components set to zero.

Example


let m = Matrix2x3::from_diagonal_element(5.0);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_diagonal_element(2, 3, 5.0);

assert!(m.m11 == 5.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 5.0 && m.m23 == 0.0);
assert!(dm[(0, 0)] == 5.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 5.0 && dm[(1, 2)] == 0.0);

pub fn from_partial_diagonal(nrows: usize, ncols: usize, elts: &[N]) -> Self where
    N: Zero
[src]

Creates a new matrix that may be rectangular. The first elts.len() diagonal elements are filled with the content of elts. Others are set to 0.

Panics if elts.len() is larger than the minimum among nrows and ncols.

Example


let m = Matrix3::from_partial_diagonal(&[1.0, 2.0]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_partial_diagonal(3, 3, &[1.0, 2.0]);

assert!(m.m11 == 1.0 && m.m12 == 0.0 && m.m13 == 0.0 &&
        m.m21 == 0.0 && m.m22 == 2.0 && m.m23 == 0.0 &&
        m.m31 == 0.0 && m.m32 == 0.0 && m.m33 == 0.0);
assert!(dm[(0, 0)] == 1.0 && dm[(0, 1)] == 0.0 && dm[(0, 2)] == 0.0 &&
        dm[(1, 0)] == 0.0 && dm[(1, 1)] == 2.0 && dm[(1, 2)] == 0.0 &&
        dm[(2, 0)] == 0.0 && dm[(2, 1)] == 0.0 && dm[(2, 2)] == 0.0);

pub fn from_distribution<Distr: Distribution<N> + ?Sized, G: Rng + ?Sized>(
    nrows: usize,
    ncols: usize,
    distribution: &Distr,
    rng: &mut G
) -> Self
[src]

Creates a matrix or vector filled with random values from the given distribution.

pub fn new_random(nrows: usize, ncols: usize) -> Self where
    Standard: Distribution<N>, 
[src]

Creates a matrix filled with random values.

impl<N: Scalar, R: DimName, C: DimName> MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

pub fn from_row_slice(data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in row-major order.

The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.

Example


let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn from_column_slice(data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in column-major order.

Example


let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_vec(data: Vec<N>) -> Self[src]

Creates a matrix backed by a given Vec.

The output matrix is filled column-by-column.

Example


let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);

assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);


// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);

assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

impl<N: Scalar, R: DimName> MatrixMN<N, R, Dynamic> where
    DefaultAllocator: Allocator<N, R, Dynamic>, 
[src]

pub fn from_row_slice(data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in row-major order.

The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.

Example


let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn from_column_slice(data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in column-major order.

Example


let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_vec(data: Vec<N>) -> Self[src]

Creates a matrix backed by a given Vec.

The output matrix is filled column-by-column.

Example


let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);

assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);


// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);

assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

impl<N: Scalar, C: DimName> MatrixMN<N, Dynamic, C> where
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

pub fn from_row_slice(data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in row-major order.

The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.

Example


let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn from_column_slice(data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in column-major order.

Example


let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_vec(data: Vec<N>) -> Self[src]

Creates a matrix backed by a given Vec.

The output matrix is filled column-by-column.

Example


let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);

assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);


// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);

assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

impl<N: Scalar> MatrixMN<N, Dynamic, Dynamic> where
    DefaultAllocator: Allocator<N, Dynamic, Dynamic>, 
[src]

pub fn from_row_slice(nrows: usize, ncols: usize, data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in row-major order.

The order of elements in the slice must follow the usual mathematic writing, i.e., row-by-row.

Example


let v = Vector3::from_row_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_row_slice(&[0, 1, 2]);
let m = Matrix2x3::from_row_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_row_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 1 && m.m13 == 2 &&
        m.m21 == 3 && m.m22 == 4 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 1 && dm[(0, 2)] == 2 &&
        dm[(1, 0)] == 3 && dm[(1, 1)] == 4 && dm[(1, 2)] == 5);

pub fn from_column_slice(nrows: usize, ncols: usize, data: &[N]) -> Self[src]

Creates a matrix with its elements filled with the components provided by a slice in column-major order.

Example


let v = Vector3::from_column_slice(&[0, 1, 2]);
// The additional argument represents the vector dimension.
let dv = DVector::from_column_slice(&[0, 1, 2]);
let m = Matrix2x3::from_column_slice(&[0, 1, 2, 3, 4, 5]);
// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_column_slice(2, 3, &[0, 1, 2, 3, 4, 5]);

assert!(v.x == 0 && v.y == 1 && v.z == 2);
assert!(dv[0] == 0 && dv[1] == 1 && dv[2] == 2);
assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);
assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

pub fn from_vec(nrows: usize, ncols: usize, data: Vec<N>) -> Self[src]

Creates a matrix backed by a given Vec.

The output matrix is filled column-by-column.

Example


let m = Matrix2x3::from_vec(vec![0, 1, 2, 3, 4, 5]);

assert!(m.m11 == 0 && m.m12 == 2 && m.m13 == 4 &&
        m.m21 == 1 && m.m22 == 3 && m.m23 == 5);


// The two additional arguments represent the matrix dimensions.
let dm = DMatrix::from_vec(2, 3, vec![0, 1, 2, 3, 4, 5]);

assert!(dm[(0, 0)] == 0 && dm[(0, 1)] == 2 && dm[(0, 2)] == 4 &&
        dm[(1, 0)] == 1 && dm[(1, 1)] == 3 && dm[(1, 2)] == 5);

impl<N> MatrixMN<N, U2, U2> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U2>, 
[src]

pub fn new(m11: N, m12: N, m21: N, m22: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U3, U3> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U4, U4> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U5, U5> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U6, U6> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m46: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N,
    m56: N,
    m61: N,
    m62: N,
    m63: N,
    m64: N,
    m65: N,
    m66: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U2, U3> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U3>, 
[src]

pub fn new(m11: N, m12: N, m13: N, m21: N, m22: N, m23: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U2, U4> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U2, U5> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U2, U6> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U3, U2> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U2>, 
[src]

pub fn new(m11: N, m12: N, m21: N, m22: N, m31: N, m32: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U3, U4> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U3, U5> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U3, U6> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U4, U2> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U2>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m21: N,
    m22: N,
    m31: N,
    m32: N,
    m41: N,
    m42: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U4, U3> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N,
    m41: N,
    m42: N,
    m43: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U4, U5> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U4, U6> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m46: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U5, U2> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U2>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m21: N,
    m22: N,
    m31: N,
    m32: N,
    m41: N,
    m42: N,
    m51: N,
    m52: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U5, U3> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N,
    m41: N,
    m42: N,
    m43: N,
    m51: N,
    m52: N,
    m53: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U5, U4> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U5, U6> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U6>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m16: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m26: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m36: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m46: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N,
    m56: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U6, U2> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U2>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m21: N,
    m22: N,
    m31: N,
    m32: N,
    m41: N,
    m42: N,
    m51: N,
    m52: N,
    m61: N,
    m62: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U6, U3> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U3>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m21: N,
    m22: N,
    m23: N,
    m31: N,
    m32: N,
    m33: N,
    m41: N,
    m42: N,
    m43: N,
    m51: N,
    m52: N,
    m53: N,
    m61: N,
    m62: N,
    m63: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U6, U4> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U4>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m61: N,
    m62: N,
    m63: N,
    m64: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U6, U5> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U5>, 
[src]

pub fn new(
    m11: N,
    m12: N,
    m13: N,
    m14: N,
    m15: N,
    m21: N,
    m22: N,
    m23: N,
    m24: N,
    m25: N,
    m31: N,
    m32: N,
    m33: N,
    m34: N,
    m35: N,
    m41: N,
    m42: N,
    m43: N,
    m44: N,
    m45: N,
    m51: N,
    m52: N,
    m53: N,
    m54: N,
    m55: N,
    m61: N,
    m62: N,
    m63: N,
    m64: N,
    m65: N
) -> Self
[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U1, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U1>, 
[src]

pub fn new(x: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U1, U2> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U2>, 
[src]

pub fn new(x: N, y: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U1, U3> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U3>, 
[src]

pub fn new(x: N, y: N, z: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U1, U4> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U4>, 
[src]

pub fn new(x: N, y: N, z: N, w: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U1, U5> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U5>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U1, U6> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U6>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N, b: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U2, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U1>, 
[src]

pub fn new(x: N, y: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U3, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U1>, 
[src]

pub fn new(x: N, y: N, z: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U4, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U1>, 
[src]

pub fn new(x: N, y: N, z: N, w: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U5, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U1>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N) -> Self[src]

Initializes this matrix from its components.

impl<N> MatrixMN<N, U6, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U1>, 
[src]

pub fn new(x: N, y: N, z: N, w: N, a: N, b: N) -> Self[src]

Initializes this matrix from its components.

impl<N: Scalar, C: Dim> MatrixMN<N, Dynamic, C> where
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

pub fn resize_vertically_mut(&mut self, new_nrows: usize, val: N) where
    DefaultAllocator: Reallocator<N, Dynamic, C, Dynamic, C>, 
[src]

Changes the number of rows of this matrix in-place.

The values are copied such that self[(i, j)] == result[(i, j)]. If the result has more rows than self, then the extra rows are filled with val.

Defined only for owned matrices with a dynamic number of rows (for example, DVector).

impl<N: Scalar, R: Dim> MatrixMN<N, R, Dynamic> where
    DefaultAllocator: Allocator<N, R, Dynamic>, 
[src]

pub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: N) where
    DefaultAllocator: Reallocator<N, R, Dynamic, R, Dynamic>, 
[src]

Changes the number of column of this matrix in-place.

The values are copied such that self[(i, j)] == result[(i, j)]. If the result has more columns than self, then the extra columns are filled with val.

Defined only for owned matrices with a dynamic number of columns (for example, DVector).

Trait Implementations

impl<N, R: DimName, C: DimName> Bounded for MatrixMN<N, R, C> where
    N: Scalar + Bounded,
    DefaultAllocator: Allocator<N, R, C>, 
[src]

impl<'b, N, R1: DimName, C1: DimName> DivAssign<&'b Rotation<N, C1>> for MatrixMN<N, R1, C1> where
    N: Scalar + Zero + One + ClosedAdd + ClosedMul,
    DefaultAllocator: Allocator<N, R1, C1> + Allocator<N, C1, C1>, 
[src]

impl<N, R1: DimName, C1: DimName> DivAssign<Rotation<N, C1>> for MatrixMN<N, R1, C1> where
    N: Scalar + Zero + One + ClosedAdd + ClosedMul,
    DefaultAllocator: Allocator<N, R1, C1> + Allocator<N, C1, C1>, 
[src]

impl<N: Scalar> From<[[N; 2]; 2]> for MatrixMN<N, U2, U2> where
    DefaultAllocator: Allocator<N, U2, U2>, 
[src]

impl<N: Scalar> From<[[N; 2]; 3]> for MatrixMN<N, U2, U3> where
    DefaultAllocator: Allocator<N, U2, U3>, 
[src]

impl<N: Scalar> From<[[N; 2]; 4]> for MatrixMN<N, U2, U4> where
    DefaultAllocator: Allocator<N, U2, U4>, 
[src]

impl<N: Scalar> From<[[N; 2]; 5]> for MatrixMN<N, U2, U5> where
    DefaultAllocator: Allocator<N, U2, U5>, 
[src]

impl<N: Scalar> From<[[N; 2]; 6]> for MatrixMN<N, U2, U6> where
    DefaultAllocator: Allocator<N, U2, U6>, 
[src]

impl<N: Scalar> From<[[N; 3]; 2]> for MatrixMN<N, U3, U2> where
    DefaultAllocator: Allocator<N, U3, U2>, 
[src]

impl<N: Scalar> From<[[N; 3]; 3]> for MatrixMN<N, U3, U3> where
    DefaultAllocator: Allocator<N, U3, U3>, 
[src]

impl<N: Scalar> From<[[N; 3]; 4]> for MatrixMN<N, U3, U4> where
    DefaultAllocator: Allocator<N, U3, U4>, 
[src]

impl<N: Scalar> From<[[N; 3]; 5]> for MatrixMN<N, U3, U5> where
    DefaultAllocator: Allocator<N, U3, U5>, 
[src]

impl<N: Scalar> From<[[N; 3]; 6]> for MatrixMN<N, U3, U6> where
    DefaultAllocator: Allocator<N, U3, U6>, 
[src]

impl<N: Scalar> From<[[N; 4]; 2]> for MatrixMN<N, U4, U2> where
    DefaultAllocator: Allocator<N, U4, U2>, 
[src]

impl<N: Scalar> From<[[N; 4]; 3]> for MatrixMN<N, U4, U3> where
    DefaultAllocator: Allocator<N, U4, U3>, 
[src]

impl<N: Scalar> From<[[N; 4]; 4]> for MatrixMN<N, U4, U4> where
    DefaultAllocator: Allocator<N, U4, U4>, 
[src]

impl<N: Scalar> From<[[N; 4]; 5]> for MatrixMN<N, U4, U5> where
    DefaultAllocator: Allocator<N, U4, U5>, 
[src]

impl<N: Scalar> From<[[N; 4]; 6]> for MatrixMN<N, U4, U6> where
    DefaultAllocator: Allocator<N, U4, U6>, 
[src]

impl<N: Scalar> From<[[N; 5]; 2]> for MatrixMN<N, U5, U2> where
    DefaultAllocator: Allocator<N, U5, U2>, 
[src]

impl<N: Scalar> From<[[N; 5]; 3]> for MatrixMN<N, U5, U3> where
    DefaultAllocator: Allocator<N, U5, U3>, 
[src]

impl<N: Scalar> From<[[N; 5]; 4]> for MatrixMN<N, U5, U4> where
    DefaultAllocator: Allocator<N, U5, U4>, 
[src]

impl<N: Scalar> From<[[N; 5]; 5]> for MatrixMN<N, U5, U5> where
    DefaultAllocator: Allocator<N, U5, U5>, 
[src]

impl<N: Scalar> From<[[N; 5]; 6]> for MatrixMN<N, U5, U6> where
    DefaultAllocator: Allocator<N, U5, U6>, 
[src]

impl<N: Scalar> From<[[N; 6]; 2]> for MatrixMN<N, U6, U2> where
    DefaultAllocator: Allocator<N, U6, U2>, 
[src]

impl<N: Scalar> From<[[N; 6]; 3]> for MatrixMN<N, U6, U3> where
    DefaultAllocator: Allocator<N, U6, U3>, 
[src]

impl<N: Scalar> From<[[N; 6]; 4]> for MatrixMN<N, U6, U4> where
    DefaultAllocator: Allocator<N, U6, U4>, 
[src]

impl<N: Scalar> From<[[N; 6]; 5]> for MatrixMN<N, U6, U5> where
    DefaultAllocator: Allocator<N, U6, U5>, 
[src]

impl<N: Scalar> From<[[N; 6]; 6]> for MatrixMN<N, U6, U6> where
    DefaultAllocator: Allocator<N, U6, U6>, 
[src]

impl<N: Scalar + PrimitiveSimdValue, R: Dim, C: Dim> From<[Matrix<<N as SimdValue>::Element, R, C, <DefaultAllocator as Allocator<<N as SimdValue>::Element, R, C>>::Buffer>; 16]> for MatrixMN<N, R, C> where
    N: From<[<N as SimdValue>::Element; 16]>,
    N::Element: Scalar + SimdValue,
    DefaultAllocator: Allocator<N, R, C> + Allocator<N::Element, R, C>, 
[src]

impl<N: Scalar + PrimitiveSimdValue, R: Dim, C: Dim> From<[Matrix<<N as SimdValue>::Element, R, C, <DefaultAllocator as Allocator<<N as SimdValue>::Element, R, C>>::Buffer>; 2]> for MatrixMN<N, R, C> where
    N: From<[<N as SimdValue>::Element; 2]>,
    N::Element: Scalar + SimdValue,
    DefaultAllocator: Allocator<N, R, C> + Allocator<N::Element, R, C>, 
[src]

impl<N: Scalar + PrimitiveSimdValue, R: Dim, C: Dim> From<[Matrix<<N as SimdValue>::Element, R, C, <DefaultAllocator as Allocator<<N as SimdValue>::Element, R, C>>::Buffer>; 4]> for MatrixMN<N, R, C> where
    N: From<[<N as SimdValue>::Element; 4]>,
    N::Element: Scalar + SimdValue,
    DefaultAllocator: Allocator<N, R, C> + Allocator<N::Element, R, C>, 
[src]

impl<N: Scalar + PrimitiveSimdValue, R: Dim, C: Dim> From<[Matrix<<N as SimdValue>::Element, R, C, <DefaultAllocator as Allocator<<N as SimdValue>::Element, R, C>>::Buffer>; 8]> for MatrixMN<N, R, C> where
    N: From<[<N as SimdValue>::Element; 8]>,
    N::Element: Scalar + SimdValue,
    DefaultAllocator: Allocator<N, R, C> + Allocator<N::Element, R, C>, 
[src]

impl<N> From<[N; 1]> for MatrixMN<N, U1, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U1>, 
[src]

impl<N> From<[N; 10]> for MatrixMN<N, U1, U10> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U10>, 
[src]

impl<N> From<[N; 10]> for MatrixMN<N, U10, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U10, U1>, 
[src]

impl<N> From<[N; 11]> for MatrixMN<N, U1, U11> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U11>, 
[src]

impl<N> From<[N; 11]> for MatrixMN<N, U11, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U11, U1>, 
[src]

impl<N> From<[N; 12]> for MatrixMN<N, U1, U12> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U12>, 
[src]

impl<N> From<[N; 12]> for MatrixMN<N, U12, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U12, U1>, 
[src]

impl<N> From<[N; 13]> for MatrixMN<N, U1, U13> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U13>, 
[src]

impl<N> From<[N; 13]> for MatrixMN<N, U13, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U13, U1>, 
[src]

impl<N> From<[N; 14]> for MatrixMN<N, U1, U14> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U14>, 
[src]

impl<N> From<[N; 14]> for MatrixMN<N, U14, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U14, U1>, 
[src]

impl<N> From<[N; 15]> for MatrixMN<N, U1, U15> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U15>, 
[src]

impl<N> From<[N; 15]> for MatrixMN<N, U15, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U15, U1>, 
[src]

impl<N> From<[N; 16]> for MatrixMN<N, U1, U16> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U16>, 
[src]

impl<N> From<[N; 16]> for MatrixMN<N, U16, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U16, U1>, 
[src]

impl<N> From<[N; 2]> for MatrixMN<N, U1, U2> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U2>, 
[src]

impl<N> From<[N; 2]> for MatrixMN<N, U2, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U2, U1>, 
[src]

impl<N> From<[N; 3]> for MatrixMN<N, U1, U3> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U3>, 
[src]

impl<N> From<[N; 3]> for MatrixMN<N, U3, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U3, U1>, 
[src]

impl<N> From<[N; 4]> for MatrixMN<N, U1, U4> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U4>, 
[src]

impl<N> From<[N; 4]> for MatrixMN<N, U4, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U4, U1>, 
[src]

impl<N> From<[N; 5]> for MatrixMN<N, U1, U5> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U5>, 
[src]

impl<N> From<[N; 5]> for MatrixMN<N, U5, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U5, U1>, 
[src]

impl<N> From<[N; 6]> for MatrixMN<N, U1, U6> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U6>, 
[src]

impl<N> From<[N; 6]> for MatrixMN<N, U6, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U6, U1>, 
[src]

impl<N> From<[N; 7]> for MatrixMN<N, U1, U7> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U7>, 
[src]

impl<N> From<[N; 7]> for MatrixMN<N, U7, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U7, U1>, 
[src]

impl<N> From<[N; 8]> for MatrixMN<N, U1, U8> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U8>, 
[src]

impl<N> From<[N; 8]> for MatrixMN<N, U8, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U8, U1>, 
[src]

impl<N> From<[N; 9]> for MatrixMN<N, U1, U9> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U1, U9>, 
[src]

impl<N> From<[N; 9]> for MatrixMN<N, U9, U1> where
    N: Scalar,
    DefaultAllocator: Allocator<N, U9, U1>, 
[src]

impl<'b, N, R1: DimName, C1: DimName> MulAssign<&'b Rotation<N, C1>> for MatrixMN<N, R1, C1> where
    N: Scalar + Zero + One + ClosedAdd + ClosedMul,
    DefaultAllocator: Allocator<N, R1, C1> + Allocator<N, C1, C1>, 
[src]

impl<N, R1: DimName, C1: DimName> MulAssign<Rotation<N, C1>> for MatrixMN<N, R1, C1> where
    N: Scalar + Zero + One + ClosedAdd + ClosedMul,
    DefaultAllocator: Allocator<N, R1, C1> + Allocator<N, C1, C1>, 
[src]

impl<N: SimdComplexField, R: Dim, C: Dim> Normed for MatrixMN<N, R, C> where
    DefaultAllocator: Allocator<N, R, C>, 
[src]

type Norm = N::SimdRealField

The type of the norm.

impl<N, R, C> SimdValue for MatrixMN<N, R, C> where
    N: Scalar + SimdValue,
    R: Dim,
    C: Dim,
    N::Element: Scalar,
    DefaultAllocator: Allocator<N, R, C> + Allocator<N::Element, R, C>, 
[src]

type Element = MatrixMN<N::Element, R, C>

The type of the elements of each lane of this SIMD value.

type SimdBool = N::SimdBool

Type of the result of comparing two SIMD values like self.

impl<N1, N2, R1, C1, R2, C2> SubsetOf<Matrix<N2, R2, C2, <DefaultAllocator as Allocator<N2, R2, C2>>::Buffer>> for MatrixMN<N1, R1, C1> where
    R1: Dim,
    C1: Dim,
    R2: Dim,
    C2: Dim,
    N1: Scalar,
    N2: Scalar + SupersetOf<N1>,
    DefaultAllocator: Allocator<N2, R2, C2> + Allocator<N1, R1, C1> + SameShapeAllocator<N1, R1, C1, R2, C2>,
    ShapeConstraint: SameNumberOfRows<R1, R2> + SameNumberOfColumns<C1, C2>, 
[src]

impl<'a, N, C: Dim> Sum<&'a Matrix<N, Dynamic, C, <DefaultAllocator as Allocator<N, Dynamic, C>>::Buffer>> for MatrixMN<N, Dynamic, C> where
    N: Scalar + ClosedAdd + Zero,
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

fn sum<I: Iterator<Item = &'a MatrixMN<N, Dynamic, C>>>(
    iter: I
) -> MatrixMN<N, Dynamic, C>
[src]

Example

let v = &DVector::repeat(3, 1.0f64);

assert_eq!(vec![v, v, v].into_iter().sum::<DVector<f64>>(),
           v + v + v);

Panics

Panics if the iterator is empty:

iter::empty::<&DMatrix<f64>>().sum::<DMatrix<f64>>(); // panics!

impl<'a, N, R: DimName, C: DimName> Sum<&'a Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>> for MatrixMN<N, R, C> where
    N: Scalar + ClosedAdd + Zero,
    DefaultAllocator: Allocator<N, R, C>, 
[src]

impl<N, C: Dim> Sum<Matrix<N, Dynamic, C, <DefaultAllocator as Allocator<N, Dynamic, C>>::Buffer>> for MatrixMN<N, Dynamic, C> where
    N: Scalar + ClosedAdd + Zero,
    DefaultAllocator: Allocator<N, Dynamic, C>, 
[src]

fn sum<I: Iterator<Item = MatrixMN<N, Dynamic, C>>>(
    iter: I
) -> MatrixMN<N, Dynamic, C>
[src]

Example

assert_eq!(vec![DVector::repeat(3, 1.0f64),
                DVector::repeat(3, 1.0f64),
                DVector::repeat(3, 1.0f64)].into_iter().sum::<DVector<f64>>(),
           DVector::repeat(3, 1.0f64) + DVector::repeat(3, 1.0f64) + DVector::repeat(3, 1.0f64));

Panics

Panics if the iterator is empty:

iter::empty::<DMatrix<f64>>().sum::<DMatrix<f64>>(); // panics!

impl<N, R: DimName, C: DimName> Sum<Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>> for MatrixMN<N, R, C> where
    N: Scalar + ClosedAdd + Zero,
    DefaultAllocator: Allocator<N, R, C>, 
[src]

impl<N, R: DimName, C: DimName> Zero for MatrixMN<N, R, C> where
    N: Scalar + Zero + ClosedAdd,
    DefaultAllocator: Allocator<N, R, C>, 
[src]