Type Alias nalgebra::base::SMatrix

source ·
pub type SMatrix<T, const R: usize, const C: usize> = Matrix<T, Const<R>, Const<C>, ArrayStorage<T, R, C>>;
Expand description

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.

Aliased Type§

struct SMatrix<T, const R: usize, const C: usize> {
    pub data: ArrayStorage<T, R, C>,
    /* private fields */
}

Fields§

§data: ArrayStorage<T, R, C>

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<T, const R: usize, const C: usize> SMatrix<T, R, C>

source

pub const fn from_array_storage(storage: ArrayStorage<T, R, C>) -> Self

Creates a new statically-allocated matrix from the given ArrayStorage.

This method exists primarily as a workaround for the fact that from_data can not work in const fn contexts.

Trait Implementations§

source§

impl<'b, T, const R1: usize, const C1: usize> DivAssign<&'b Rotation<T, C1>> for SMatrix<T, R1, C1>
where T: Scalar + Zero + One + ClosedAdd + ClosedMul,

source§

fn div_assign(&mut self, right: &'b Rotation<T, C1>)

Performs the /= operation. Read more
source§

impl<T, const R1: usize, const C1: usize> DivAssign<Rotation<T, C1>> for SMatrix<T, R1, C1>
where T: Scalar + Zero + One + ClosedAdd + ClosedMul,

source§

fn div_assign(&mut self, right: Rotation<T, C1>)

Performs the /= operation. Read more
source§

impl<T: Scalar, const R: usize, const C: usize> From<[[T; R]; C]> for SMatrix<T, R, C>

source§

fn from(arr: [[T; R]; C]) -> Self

Converts to this type from the input type.
source§

impl<'b, T, const R1: usize, const C1: usize> MulAssign<&'b Rotation<T, C1>> for SMatrix<T, R1, C1>
where T: Scalar + Zero + One + ClosedAdd + ClosedMul,

source§

fn mul_assign(&mut self, right: &'b Rotation<T, C1>)

Performs the *= operation. Read more
source§

impl<T, const R1: usize, const C1: usize> MulAssign<Rotation<T, C1>> for SMatrix<T, R1, C1>
where T: Scalar + Zero + One + ClosedAdd + ClosedMul,

source§

fn mul_assign(&mut self, right: Rotation<T, C1>)

Performs the *= operation. Read more