utils.h (782B)
1 #ifndef UTILS_H 2 #define UTILS_H 3 4 #include <math.h> 5 #include <stdbool.h> 6 7 #define PI 3.14159265358979323846 8 #define DEGTORAD (PI/180) 9 #define CONST13 (1.0/3.0) 10 #define MAT_ELEM(mat, row, col) mat[row][col] 11 #define SMALLEST_PIVOT (1e-5) 12 #define SIZE 6 13 14 /* Function prototypes */ 15 static double factorial(int n); 16 double Sin(double x); 17 double Cos(double x); 18 void matmul(double A[3][3], double B[3][3], double result[3][3]); 19 void dot_product(double result[3], double A[3][3], double B[3]); 20 void transpose(double A[3][3], double Ai[3][3]); 21 void dispmat(double *A, int rows, int cols, bool transpose); 22 int LUDecompose(double *amat, int n, int numcols); 23 void LUSolve(double *amat, double *b, int n, int numcols); 24 double LUDeterminant(double *amat, int n, int numcols); 25 26 #endif /* UTILS_H */