Basic Functions - GelaniNijraj/cmat GitHub Wiki
List of functions
cmat_malloc
- Allocate memory for a matrixcmat_malloc_shape
- Allocate memory for a matrixcmat_from_file
- Create a matrix from filecmat_free
- Free the memory allocated by the matrixcmat_set
- Set value in the matrixcmat_get
- Get value from the matrix
cmat_malloc
Syntax : MATRIX* cmat_malloc(int rows, int cols);
Description : Allocates memory for a matrix with size rows
xcols
and returns the pointer to the MATRIX
structure.
cmat_malloc_shape
Syntax : MATRIX *cmat_malloc_shape(MATRIX *m);
Description : Allocates memory for a matrix with the same size as the matrix m
and returns the pointer to the MATRIX
structure.
cmat_from_file
Syntax : MATRIX *cmat_from_file(int rows, int cols, const char *file);
Description : Loads a matrix of rows
xcols
from previously saved file file
. Returns the pointer to the newly loaded MATRIX
.
cmat_free
Syntax : void cmat_free(MATRIX *m);
Description : Frees the memory allocated to the matrix pointed by m
.
cmat_set
Syntax : int cmat_set(MATRIX *m, int row, int col, double val);
Description : Sets the value val
at row
xcol
in the matrix pointed by m
.
cmat_get
Syntax : double cmat_get(MATRIX *m, int row, int col);
Description : Returns the value stored at row
xcol
in the matrix pointed by m
.