-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix.h
37 lines (29 loc) · 1.32 KB
/
matrix.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef RENDER_MATRIX_H
#define RENDER_MATRIX_H
#include "common.h"
typedef struct tagMatrix {
uint32_t rows;
uint32_t columns;
Real *matrix; // {{1,2,3},{4,5,6},{7,8,9}} -> {1,2,3,4,5,6,7,8,9}
} Matrix;
Matrix *MatrixZero(uint32_t rows, uint32_t columns);
Matrix *MatrixFromArray(uint32_t rows, uint32_t columns, const Real array[rows][columns]);
bool MatrixDestroy(Matrix *a);
bool MatrixCompare(const Matrix *a, const Matrix *b);
bool MatrixCompareLoose(const Matrix *a, const Matrix *b, Real error);
Matrix *MatrixClone(const Matrix *a);
void MatrixPrint(const Matrix *a);
Real MatrixGetElement(const Matrix *a, uint32_t rows, uint32_t columns);
bool MatrixSetElement(Matrix *a, uint32_t rows, uint32_t columns, Real value);
Matrix *MatrixIdentity(uint32_t n);
Matrix *MatrixTranspose(const Matrix *a);
Real MatrixDeterminant(const Matrix *a);
Matrix *MatrixInverse(const Matrix *a);
Matrix *MatrixAddition(const Matrix *a, const Matrix *b);
Matrix *MatrixSubtraction(const Matrix *a, const Matrix *b);
Matrix *MatrixMultiplication(const Matrix *a, const Matrix *b);
Matrix *MatrixScalarAddition(const Matrix *a, Real value);
Matrix *MatrixScalarSubtraction(const Matrix *a, Real value);
Matrix *MatrixScalarMultiplication(const Matrix *a, Real value);
Matrix *MatrixScalarDivision(const Matrix *a, Real value);
#endif // RENDER_MATRIX_H