Melee Modding Library  2.0.0
A C library for modding Super Smash Bros Melee
matrix.h
Go to the documentation of this file.
1 
10 #ifndef MML_MATRIX_H
11 #define MML_MATRIX_H
12 
13 #include "gctypes.h"
14 
16 extern bool _matrixError;
17 
19 typedef struct
20 {
21  float* data;
22  size_t size;
24 } Vector;
25 
27 typedef struct
28 {
29  float** data;
30  size_t nRow;
31  size_t nCol;
33 } Matrix;
34 
36 #define ROW_VECTOR(mat, ndx) ((Vector) {mat.data[ndx], mat.nCol})
37 
47 bool initVector(Vector* vec, size_t size);
48 
59 bool initMatrix(Matrix* mat, size_t numRows, size_t numCols);
60 
72 void populateVec(Vector* vec, void* func);
73 
87 void populateMat(Matrix* mat, void* func);
88 
103 void matrixVectorProduct(Vector* y, const Matrix* A, const Vector* x);
104 
116 float vectorDotProd(const Vector* u, const Vector* v);
117 
118 #endif
float vectorDotProd(const Vector *u, const Vector *v)
Calculates the dot product of two vectors.
Definition: matrix.c:126
void matrixVectorProduct(Vector *y, const Matrix *A, const Vector *x)
Multiplication of the form y = Ax
Definition: matrix.c:109
float * data
Definition: matrix.h:21
Data types for the gamecube.
bool _matrixError
Set to true when a error occurs in a matrix operation.
Definition: matrix.c:6
A vector of 32-bit floating-point values.
Definition: matrix.h:19
size_t nCol
Definition: matrix.h:31
void populateVec(Vector *vec, void *func)
Populate the values in a vector.
Definition: matrix.c:50
bool initVector(Vector *vec, size_t size)
Initialize a Vector.
Definition: matrix.c:34
size_t nRow
Definition: matrix.h:30
float ** data
Definition: matrix.h:29
bool initMatrix(Matrix *mat, size_t numRows, size_t numCols)
Initialize a matrix.
Definition: matrix.c:8
size_t size
Definition: matrix.h:22
A matrix of 32-bit floating-point values.
Definition: matrix.h:27
void populateMat(Matrix *mat, void *func)
Populate the values in a matrix.
Definition: matrix.c:60