Module beagle::mat [] [src]

An row-major array of vectors, written Mat<R, C, T> but pronounced 'matrix'.

Matrices support binary operations between two Matrices or between one Matrix and one Scalar. All Arithmetic operators and Bitwise operators are supported, where the two Scalar types involved support the operation. Most operations operate on each component separately.

The exceptions is matrix multiplied by matrix, which requires performs a linear algebraic multiplication and requires the underlying Scalar types to support Add and Mul.

Matrices can be multiplied by a vector, vector multiplied by matrix, both of which also require the underlying Scalar types to support Add and Mul.

Matrices also support Negation and Logical Negation where the underlying Scalar Type supports it.

Mat1x1, Mat1x2, etc. aliases are provided to simplify typing, as well as Mat1, Mat2, etc. for square matrices.

Examples

use beagle::mat::{Mat3};
use beagle::vec::{Vec3};

let m = Mat3::new([
    [ 2f32,  3f32,  5f32],
    [ 7f32, 11f32, 13f32],
    [17f32, 19f32, 23f32]]);
let v = Vec3::new([29f32, 31f32, 37f32]);
assert_eq!(m*v, Vec3::new([336f32, 1025f32, 1933f32]));

Structs

Mat

An row-major array of vectors, written Mat<R, C, T> but pronounced 'matrix'.

Type Definitions

Mat1

An alias for Mat<One, One, T>

Mat2

An alias for Mat<Two, Two, T>

Mat3

An alias for Mat<Three, Three, T>

Mat4

An alias for Mat<Four, Four, T>

Mat1x1

An alias for Mat<One, One, T>

Mat1x2

An alias for Mat<One, Two, T>

Mat1x3

An alias for Mat<One, Three, T>

Mat1x4

An alias for Mat<One, Four, T>

Mat2x1

An alias for Mat<Two, One, T>

Mat2x2

An alias for Mat<Two, Two, T>

Mat2x3

An alias for Mat<Two, Three, T>

Mat2x4

An alias for Mat<Two, Four, T>

Mat3x1

An alias for Mat<Three, One, T>

Mat3x2

An alias for Mat<Three, Two, T>

Mat3x3

An alias for Mat<Three, Three, T>

Mat3x4

An alias for Mat<Three, Four, T>

Mat4x1

An alias for Mat<Four, One, T>

Mat4x2

An alias for Mat<Four, Two, T>

Mat4x3

An alias for Mat<Four, Three, T>

Mat4x4

An alias for Mat<Four, Four, T>