Skip to main content

InputMatrix

Type Alias InputMatrix 

Source
pub type InputMatrix<'a> = Matrix<f64, Dyn, Dyn, ViewStorage<'a, f64, Dyn, Dyn, Const<1>, Dyn>>;
Expand description

Borrowed 2D matrix view type accepted by constraint-ingestion APIs.

Internally this is a dynamic nalgebra matrix view with column stride support, allowing callers to pass slices, vectors, matrix columns, or full views without allocation.

Aliased Type§

pub struct InputMatrix<'a> {
    pub data: ViewStorage<'a, f64, Dyn, Dyn, Const<1>, Dyn>,
    /* private fields */
}

Fields§

§data: ViewStorage<'a, f64, Dyn, Dyn, Const<1>, Dyn>

The data storage that contains all the matrix components. Disappointed?

Well, if you came here to see how you can access the matrix components, you may be in luck: you can access the individual components of all vectors with compile-time dimensions <= 6 using field notation like this: vec.x, vec.y, vec.z, vec.w, vec.a, vec.b. Reference and assignation work too:

let mut vec = Vector3::new(1.0, 2.0, 3.0);
vec.x = 10.0;
vec.y += 30.0;
assert_eq!(vec.x, 10.0);
assert_eq!(vec.y + 100.0, 132.0);

Similarly, for matrices with compile-time dimensions <= 6, you can use field notation like this: mat.m11, mat.m42, etc. The first digit identifies the row to address and the second digit identifies the column to address. So mat.m13 identifies the component at the first row and third column (note that the count of rows and columns start at 1 instead of 0 here. This is so we match the mathematical notation).

For all matrices and vectors, independently from their size, individual components can be accessed and modified using indexing: vec[20], mat[(20, 19)]. Here the indexing starts at 0 as you would expect.

Trait Implementations§

Source§

impl AsInputMatrix1D for InputMatrix<'_>

Source§

fn as_input_matrix(&self) -> InputMatrix<'_>

Borrow input data as a 1 x N matrix view.
Source§

impl UpperBound for &InputMatrix<'_>

Source§

fn check_valid(&self, dim: usize) -> bool

Validate that input row count is compatible with robot dimension dim.
Source§

fn ncols(&self) -> usize

Number of station columns represented by this bound input.
Source§

fn as_matrix(&self) -> InputMatrix<'_>

Borrow input as a matrix view (dim x ncols).