Matrix
API
#include <ds/mat.h>
Handle
-
struct mat
View into memory representing a matrix.
Utilities to manipulate a row-major matrix stored on a contiguous block of memory.
Functions
-
void mat_make(struct mat *p, size_t el_size, size_t ino, size_t jno)
Initializes a matrix and allocates its memory.
Every call to mat_make must have a matching call to mat_del to release the managed memory.
- Parameters:
p – Handle to the slice.
el_size – Size of each element.
ino – Number of columns.
jno – Number of rows.
-
void mat_del(struct mat *p)
Deallocates the memory backing a matrix created by mat_make.
- Parameters:
p – Handle to the matrix.
-
size_t mat_idxof(struct mat *p, size_t i, size_t j)
Returns the byte offset to the ij-th element on the underlying array.
- Parameters:
p – Handle to the matrix.
i
j