Expand description
Utility functions for working with matrices.
Traits§
- Matrix
Value - Things that can appear inside a matrix.
Functions§
- bound_
index_ domains_ of_ expr - Gets concrete index domains for a matrix expression.
- enumerate_
index_ union_ indices - See
enumerate_indices. This function zips the two given lists of index domains, performs a union on each pair, and returns an enumerating iterator over the new list of domains. - enumerate_
indices - For some index domains, returns a list containing each of the possible indices.
- flat_
index_ to_ full_ index - Given index domains for a multi-dimensional matrix and the nth index in the flattened matrix, find the coordinates in the original matrix
- flatten
- Flattens a multi-dimensional matrix into a one-dimensional slice of its elements.
The elements are returned in row-major ordering (see
enumerate_indices). The elements are borrowed; To consume the matrix and return owned values, see flatten_owned. - flatten_
enumerate - Flattens a multi-dimensional matrix literal into an iterator over (indices,element).
- flatten_
owned - Consumes a multi-dimensional matrix and returns a one-dimensional slice of its elements.
The elements are returned in row-major ordering (see
enumerate_indices). - index_
domains - Gets the index domains for a matrix literal.
- num_
elements - Returns the number of possible elements indexable by the given index domains.
- partial_
flatten - Given a nested matrix, flatten its first
n+1dimensions into one. The resulting matrix will be a list because otherwise index domains would get weird, fast… (unless we want to only support integer indices?) - resolved_
index_ domains - Gets the index domains for a matrix expression and resolves them
- safe_
index_ optimised - This is the same as
m[x]except whenmis of the forms: - shape_
of - Given an AbstractLiteral::Matrix, get its [MatrixShape]
- shape_
of_ dom - Same as shape_of but for a ground matrix domain
- shape_
of_ matrix_ expr - If this is a matrix expression (as defined by Expr::unwrap_matrix_unchecked), get its [MatrixShape]. See also: shape_of.
- try_
enumerate_ indices - For some index domains, returns a list containing each of the possible indices.
- unflatten_
list - Same transformation as unflatten_matrix, but all index domains become
int(1..) - unflatten_
matrix - “Un-flatten” a slice of elements into a Matrix with the given index domains