orx_v::matrices

Trait V1MatrixLayout

Source
pub trait V1MatrixLayout: Clone {
    // Required methods
    fn num_rows(&self) -> usize;
    fn num_cols(&self) -> usize;
    fn num_children(&self) -> usize;
    fn num_children_secondary(&self) -> usize;
    fn v1_idx(&self, i: usize, j: usize) -> usize;
    fn child<T, V>(&self, data: V, first_idx: usize) -> impl NVec<D1, T>
       where V: NVec<D1, T>;
    fn child_mut<T, V>(&self, data: V, first_idx: usize) -> impl NVecMut<D1, T>
       where V: NVecMut<D1, T>;
}
Expand description

Layout for matrices with an underlying flat vector of D1.

Required Methods§

Source

fn num_rows(&self) -> usize

Number of rows.

Source

fn num_cols(&self) -> usize

Number of columns.

Source

fn num_children(&self) -> usize

Number of primary children:

  • number of rows if row-major,
  • number of columns if col-major.
Source

fn num_children_secondary(&self) -> usize

Number of children of the transpose of the matrix:

  • number of rows if col-major,
  • number of columns if row-major.
Source

fn v1_idx(&self, i: usize, j: usize) -> usize

Transformation of the row and column indices (i, j) into a one dimensional index for the underlying data.

Source

fn child<T, V>(&self, data: V, first_idx: usize) -> impl NVec<D1, T>
where V: NVec<D1, T>,

Child of the matrix:

  • row if row-major,
  • column if col-major.
Source

fn child_mut<T, V>(&self, data: V, first_idx: usize) -> impl NVecMut<D1, T>
where V: NVecMut<D1, T>,

Mutable child of the matrix:

  • row if row-major,
  • column if col-major.

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.

Implementors§