int MatrixScaleByConst(Matrix *mat, double alpha)
Scale a matrix by a constant factor.
Definition: matrix.c:101
int PrintMatrix(const Matrix *mat)
Print the elements of a matrix to stdout.
Definition: matrix.c:141
Matrix NewMatrix(int rows, int cols)
Allocate a new matrix on the heap.
Definition: matrix.c:13
int MatrixSetElement(Matrix *mat, int row, int col, double val)
The a matrix element to a given value.
Definition: matrix.c:62
int MatrixGetLinearIndex(const Matrix *mat, int row, int col)
Get the linear index for a given row and column in the matrix.
Definition: matrix.c:43
int MatrixCopyTranspose(Matrix *dest, Matrix *src)
Copy a matrix to another matrix, transposed.
Definition: matrix.c:83
int MatrixNumElements(const Matrix *mat)
Get the number of elements in a matrix, i.e. m * n.
Definition: matrix.c:38
int PrintRowVector(const Matrix *mat)
Print the entire matrix as a row vector.
Definition: matrix.c:152
Represents a matrix of double-precision data.
Definition: matrix.h:71
int MatrixCopy(Matrix *dest, Matrix *src)
Copy a matrix to another matrix.
Definition: matrix.c:73
double MatrixNormedDifference(Matrix *A, Matrix *B)
Return the normed difference between 2 matrices of the same size.
Definition: matrix.c:109
int MatrixSetConst(Matrix *mat, double val)
Sets all of the elements in a matrix to a single value.
Definition: matrix.c:19
double * MatrixGetElement(const Matrix *mat, int row, int col)
Get the element of a matrix given row, column indices.
Definition: matrix.c:49
int FreeMatrix(Matrix *mat)
Free the data for a matrix.
Definition: matrix.c:27
double * MatrixGetElementTranspose(const Matrix *mat, int row, int col, bool istranposed)
Get the element of a matrix or its transpose.
Definition: matrix.c:54
int MatrixFlatten(Matrix *mat)
Flatten a 2D matrix to a column vector.
Definition: matrix.c:125
int MatrixFlattenToRow(Matrix *mat)
Flatten a 2D matrix to a row vector.
Definition: matrix.c:133