Struct nalgebra::DMat
[−]
[src]
pub struct DMat<N> { // some fields omitted }
Matrix with dimensions unknown at compile-time.
Methods
impl<N> DMat<N>
unsafe fn new_uninitialized(nrows: usize, ncols: usize) -> DMat<N>
Creates an uninitialized matrix.
impl<N: Zero + Clone + Copy> DMat<N>
fn new_zeros(nrows: usize, ncols: usize) -> DMat<N>
Builds a matrix filled with zeros.
Arguments
dim
- The dimension of the matrix. Adim
-dimensional matrix containsdim * dim
components.
fn is_zero(&self) -> bool
Tests if all components of the matrix are zeroes.
fn reset(&mut self)
impl<N: Rand> DMat<N>
fn new_random(nrows: usize, ncols: usize) -> DMat<N>
Builds a matrix filled with random values.
impl<N: One + Clone + Copy> DMat<N>
impl<N: Clone + Copy> DMat<N>
fn from_elem(nrows: usize, ncols: usize, val: N) -> DMat<N>
Builds a matrix filled with a given constant.
fn from_row_vec(nrows: usize, ncols: usize, vec: &[N]) -> DMat<N>
Builds a matrix filled with the components provided by a vector.
The vector contains the matrix data in row-major order.
Note that from_col_vec
is a lot faster than from_row_vec
since a DMat
stores its data
in column-major order.
The vector must have at least nrows * ncols
elements.
fn from_col_vec(nrows: usize, ncols: usize, vec: &[N]) -> DMat<N>
Builds a matrix filled with the components provided by a vector.
The vector contains the matrix data in column-major order.
Note that from_col_vec
is a lot faster than from_row_vec
since a DMat
stores its data
in column-major order.
The vector must have at least nrows * ncols
elements.
impl<N> DMat<N>
fn from_fn<F: FnMut(usize, usize) -> N>(nrows: usize, ncols: usize, f: F) -> DMat<N>
Builds a matrix filled with a given constant.
fn nrows(&self) -> usize
The number of row on the matrix.
fn ncols(&self) -> usize
The number of columns on the matrix.
fn to_vec(self) -> Vec<N>
Transforms this matrix isizeo an array. This consumes the matrix and is O(1). The returned vector contains the matrix data in column-major order.
fn as_vec(&self) -> &[N]
Gets a reference to this matrix data. The returned vector contains the matrix data in column-major order.
fn as_mut_vec(&mut self) -> &mut [N]
Gets a mutable reference to this matrix data. The returned vector contains the matrix data in column-major order.