orx_v::matrices

Trait MatrixColMajor

Source
pub trait MatrixColMajor<T>: Matrix<T> {
    // Required method
    fn col(&self, j: usize) -> impl NVec<D1, T>;

    // Provided method
    fn cols(&self) -> impl Iterator<Item = impl NVec<D1, T>> { ... }
}
Expand description

A column major matrix.

Say i represents row-index and j represents col-index. In a column-major matrix:

  • it is more efficient to iterate first over j, and then over i,
  • [col(j)] often (1) returns a vector over a contagious memory location.

(1) When the data is represented by a complete allocation; however, recall that it is possible to use a function or a sparse vector backed up with a lookup as the underlying vector of the matrix.

Required Methods§

Source

fn col(&self, j: usize) -> impl NVec<D1, T>

Returns the j-th column of the matrix which is a D1 vector.

Provided Methods§

Source

fn cols(&self) -> impl Iterator<Item = impl NVec<D1, T>>

Returns an iterator over the columns of the matrix.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, M: MatrixColMajor<T>> MatrixColMajor<T> for &M

Source§

fn col(&self, j: usize) -> impl NVec<D1, T>

Source§

impl<T, M: MatrixColMajor<T>> MatrixColMajor<T> for &mut M

Source§

fn col(&self, j: usize) -> impl NVec<D1, T>

Implementors§

Source§

impl<T, V> MatrixColMajor<T> for V1Matrix<T, V, V1LayoutColMajor>
where V: NVec<D1, T>,

Source§

impl<T, V> MatrixColMajor<T> for V2MatrixColMajor<T, V>
where V: NVec<D2, T>,