sized_matrix

Type Alias Vector

Source
pub type Vector<T, const M: usize> = Matrix<T, M, 1>;
Expand description

A special case type alias for Matrices with a single column.

Aliased Type§

struct Vector<T, const M: usize> { /* private fields */ }

Implementations§

Source§

impl<T, const M: usize> Vector<T, M>

Source

pub fn vector(contents: [T; M]) -> Self

Construct a column vector from an array.

§Examples

Constructing a Vector:

use sized_matrix::{Vector, Matrix};

let vector: Vector<i32, 3> = Vector::vector([1, 2, 3]);

assert_eq!(vector, Matrix::cols([[1, 2, 3]]));

Trait Implementations§

Source§

impl<TLhs, TRhs: Copy, TOutput, const M: usize> Dot<Matrix<TRhs, M, 1>> for Vector<TLhs, M>
where TLhs: Mul<TRhs, Output = TOutput> + MulAdd<TRhs, TOutput, Output = TOutput> + Copy, TOutput: Zero,

Source§

type Output = TOutput

Source§

fn dot(self, rhs: Vector<TRhs, M>) -> Self::Output

Returns self · rhs.
Source§

impl<T, const M: usize> Index<usize> for Vector<T, M>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, const M: usize> IndexMut<usize> for Vector<T, M>

Source§

fn index_mut(&mut self, index: usize) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T, const M: usize> Init<T, usize> for Vector<T, M>

Source§

fn init_with<F: FnMut(usize) -> T>(_: (), elem: F) -> Self

Initialise an instance of this type using value by applying elem to each ‘index’ of the type. Read more
Source§

fn init<F>(elem: F) -> Self
where F: FnMut(I) -> T, V: TypeEquals<()>,

Initialise an instance of this type by applying elem to each ‘index’ of the type. Read more
Source§

impl<T: Copy, const M: usize, const M_OUT: usize> Section<usize, Matrix<T, M_OUT, 1>> for Vector<T, M>

Source§

fn section(&self, offset: usize) -> Vector<T, M_OUT>

Get a section of type TOut starting at offset offset. Read more