Type Alias nalgebra::base::MatrixViewMut

source ·
pub type MatrixViewMut<'a, T, R, C, RStride = U1, CStride = R> = Matrix<T, R, C, ViewStorageMut<'a, T, R, C, RStride, CStride>>;
Expand description

A mutable matrix view.

Aliased Type§

struct MatrixViewMut<'a, T, R, C, RStride = U1, CStride = R> {
    pub data: ViewStorageMut<'a, T, R, C, RStride, CStride>,
    /* private fields */
}

Fields§

§data: ViewStorageMut<'a, T, R, C, RStride, CStride>

The data storage that contains all the matrix components. Disappointed?

Well, if you came here to see how you can access the matrix components, you may be in luck: you can access the individual components of all vectors with compile-time dimensions <= 6 using field notation like this: vec.x, vec.y, vec.z, vec.w, vec.a, vec.b. Reference and assignation work too:

let mut vec = Vector3::new(1.0, 2.0, 3.0);
vec.x = 10.0;
vec.y += 30.0;
assert_eq!(vec.x, 10.0);
assert_eq!(vec.y + 100.0, 132.0);

Similarly, for matrices with compile-time dimensions <= 6, you can use field notation like this: mat.m11, mat.m42, etc. The first digit identifies the row to address and the second digit identifies the column to address. So mat.m13 identifies the component at the first row and third column (note that the count of rows and columns start at 1 instead of 0 here. This is so we match the mathematical notation).

For all matrices and vectors, independently from their size, individual components can be accessed and modified using indexing: vec[20], mat[(20, 19)]. Here the indexing starts at 0 as you would expect.

Implementations§

source§

impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim> MatrixViewMut<'a, T, R, C, RStride, CStride>

source

pub unsafe fn from_slice_with_strides_generic_unchecked( data: &'a mut [T], start: usize, nrows: R, ncols: C, rstride: RStride, cstride: CStride ) -> Self

Creates, without bound-checking, a mutable matrix view from an array and with dimensions and strides specified by generic types instances.

Safety

This method is unsafe because the input data array is not checked to contain enough elements. The generic types R, C, RStride, CStride can either be type-level integers or integers wrapped with Dyn().

source

pub fn from_slice_with_strides_generic( data: &'a mut [T], nrows: R, ncols: C, rstride: RStride, cstride: CStride ) -> Self

Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances.

Panics if the input data array dose not contain enough elements. The generic types R, C, RStride, CStride can either be type-level integers or integers wrapped with Dyn().

source§

impl<'a, T: Scalar, R: Dim, C: Dim> MatrixViewMut<'a, T, R, C>

source

pub unsafe fn from_slice_generic_unchecked( data: &'a mut [T], start: usize, nrows: R, ncols: C ) -> Self

Creates, without bound-checking, a mutable matrix view from an array and with dimensions specified by generic types instances.

Safety

This method is unsafe because the input data array is not checked to contain enough elements. The generic types R and C can either be type-level integers or integers wrapped with Dyn().

source

pub fn from_slice_generic(data: &'a mut [T], nrows: R, ncols: C) -> Self

Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances.

Panics if the input data array dose not contain enough elements. The generic types R and C can either be type-level integers or integers wrapped with Dyn().

source§

impl<'a, T: Scalar, R: DimName, C: DimName> MatrixViewMut<'a, T, R, C>

source

pub fn from_slice(data: &'a mut [T]) -> Self

Creates a new mutable matrix view from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_unchecked(data: &'a mut [T], start: usize) -> Self

Creates, without bound checking, a new mutable matrix view from the given data array.

source§

impl<'a, T: Scalar, R: DimName, C: DimName> MatrixViewMut<'a, T, R, C, Dyn, Dyn>

source

pub fn from_slice_with_strides_mut( data: &'a mut [T], rstride: usize, cstride: usize ) -> Self

Creates a new mutable matrix view with the specified strides from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_with_strides_unchecked( data: &'a mut [T], start: usize, rstride: usize, cstride: usize ) -> Self

Creates, without bound checking, a new mutable matrix view with the specified strides from the given data array.

source§

impl<'a, T: Scalar, R: DimName> MatrixViewMut<'a, T, R, Dyn>

source

pub fn from_slice(data: &'a mut [T], ncols: usize) -> Self

Creates a new mutable matrix view from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_unchecked( data: &'a mut [T], start: usize, ncols: usize ) -> Self

Creates, without bound checking, a new mutable matrix view from the given data array.

source§

impl<'a, T: Scalar, R: DimName> MatrixViewMut<'a, T, R, Dyn, Dyn, Dyn>

source

pub fn from_slice_with_strides_mut( data: &'a mut [T], ncols: usize, rstride: usize, cstride: usize ) -> Self

Creates a new mutable matrix view with the specified strides from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_with_strides_unchecked( data: &'a mut [T], start: usize, ncols: usize, rstride: usize, cstride: usize ) -> Self

Creates, without bound checking, a new mutable matrix view with the specified strides from the given data array.

source§

impl<'a, T: Scalar, C: DimName> MatrixViewMut<'a, T, Dyn, C>

source

pub fn from_slice(data: &'a mut [T], nrows: usize) -> Self

Creates a new mutable matrix view from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_unchecked( data: &'a mut [T], start: usize, nrows: usize ) -> Self

Creates, without bound checking, a new mutable matrix view from the given data array.

source§

impl<'a, T: Scalar, C: DimName> MatrixViewMut<'a, T, Dyn, C, Dyn, Dyn>

source

pub fn from_slice_with_strides_mut( data: &'a mut [T], nrows: usize, rstride: usize, cstride: usize ) -> Self

Creates a new mutable matrix view with the specified strides from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_with_strides_unchecked( data: &'a mut [T], start: usize, nrows: usize, rstride: usize, cstride: usize ) -> Self

Creates, without bound checking, a new mutable matrix view with the specified strides from the given data array.

source§

impl<'a, T: Scalar> MatrixViewMut<'a, T, Dyn, Dyn>

source

pub fn from_slice(data: &'a mut [T], nrows: usize, ncols: usize) -> Self

Creates a new mutable matrix view from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_unchecked( data: &'a mut [T], start: usize, nrows: usize, ncols: usize ) -> Self

Creates, without bound checking, a new mutable matrix view from the given data array.

source§

impl<'a, T: Scalar> MatrixViewMut<'a, T, Dyn, Dyn, Dyn, Dyn>

source

pub fn from_slice_with_strides_mut( data: &'a mut [T], nrows: usize, ncols: usize, rstride: usize, cstride: usize ) -> Self

Creates a new mutable matrix view with the specified strides from the given data array.

Panics if data does not contain enough elements.

source

pub unsafe fn from_slice_with_strides_unchecked( data: &'a mut [T], start: usize, nrows: usize, ncols: usize, rstride: usize, cstride: usize ) -> Self

Creates, without bound checking, a new mutable matrix view with the specified strides from the given data array.

Trait Implementations§

source§

impl<'a, T, R, C, RView, CView, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>> for MatrixViewMut<'a, T, RView, CView, RStride, CStride>
where R: Dim, C: Dim, RView: Dim, CView: Dim, RStride: Dim, CStride: Dim, S: RawStorageMut<T, R, C>, ShapeConstraint: DimEq<R, RView> + DimEq<C, CView> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,

source§

fn from(m: &'a mut Matrix<T, R, C, S>) -> Self

Converts to this type from the input type.