Skip to main content

Module matrix

Module matrix 

Source
Expand description

Utility functions for working with matrices.

Traits§

MatrixValue
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+1 dimensions 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 when m is 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