pub type Matrix1<T> = Matrix<T, U1, U1, ArrayStorage<T, 1, 1>>;
Expand description
A stack-allocated, column-major, 1x1 square matrix.
Because this is an alias, not all its methods are listed here. See the Matrix
type too.
Implementations§
source§impl<T> Matrix1<T>
impl<T> Matrix1<T>
sourcepub fn into_scalar(self) -> T
pub fn into_scalar(self) -> T
Convert this 1x1 matrix into a scalar.
As opposed to indexing, using this provides type-safety when flattening dimensions.
Example
let v = Vector3::new(0., 0., 1.);
let inner_product: f32 = (v.transpose() * v).into_scalar();
assert_eq!(inner_product, 1.);
ⓘ
let v = Vector3::new(0., 0., 1.);
let mut inner_product: f32 = (v * v.transpose()).into_scalar();