View Source CEM.MapMatrix (cem v0.1.1)
A matrix data structure based on nested maps with a very limited set of operations.
For certain problems, it's more performant to use MapMatrix
operations
than the equivalent opertations on Nx
tensors.
Summary
Functions
Given a list of lists of values, return a MapMatrix
.
Collect values at the given index pairs [{i, j},...]
into a list.
Get the value at the given index pair {i, j}
.
Set the value at the given index pair {i, j}
.
Return the shape {n_row, n_col}
of the MapMatrix
.
Convert the MapMatrix
to a list of lists of values.
Create a MapMatrix
with the shape {n_row, n_col}
and all values set to
zero.
Types
Functions
Given a list of lists of values, return a MapMatrix
.
This is useful when converting an Nx
tensor to a MapMatrix
.
Collect values at the given index pairs [{i, j},...]
into a list.
This is similar to Nx.gather/2
.
Get the value at the given index pair {i, j}
.
Set the value at the given index pair {i, j}
.
Return the shape {n_row, n_col}
of the MapMatrix
.
Convert the MapMatrix
to a list of lists of values.
The result can be passed directly to Nx.tensor/1
to get the tensor
representation of the matrix.
Create a MapMatrix
with the shape {n_row, n_col}
and all values set to
zero.