$search
00001 #ifndef MATRICES_H 00002 #define MATRICES_H 00003 00004 #include <math.h> 00005 #include <stdlib.h> 00006 00007 typedef float** matrix; // designate a matrix as an array (2D) of floatsdef Row* Matrix; 00008 00009 void addMatrix2 (float A[2][2], float B[2][2], float C[2][2]); 00010 void subMatrix2 (float A[2][2], float B[2][2], float C[2][2]); 00011 void multMatrix2(float A[2][2], float B[2][2], float C[2][2]); 00012 void subVector2 (float A[2], float B[2], float C[2]); 00013 void multMatVec2(float A[2][2], float B[2], float C[2]); 00014 void invert2(float A[2][2], float B[2][2]); 00015 void VectmultSc2(float V[2], float scl, float V1[2]); 00016 void addVector2(float V[2], float V1[2], float V2[2]); 00017 //void allocMatrix(matrix mat, int nrows, int ncolumns); 00018 void addMatrix (matrix A, matrix B, matrix C, int m, int n); 00019 void addVector (float* A, float* B, float* C, int m); 00020 void subMatrix (matrix A, matrix B, matrix C, int m, int n); 00021 void subVector (float* A, float* B, float* C, int m); 00022 void negMatrix(matrix A, int m, int n); 00023 void multMatrix(matrix A, matrix B, matrix C, int Am, int An, int Bn); 00024 void multMatVec(matrix A, float* B, float* C, int Am, int Bn); 00025 void transpose(matrix A, matrix B, int Am, int An); 00026 void invert3(matrix A, matrix B); 00027 float determinant(matrix A,matrix tmp, int n); 00028 void getMinor(matrix A, matrix B,int An, int m, int n); 00029 void invt(matrix A, matrix B, matrix tmp1, matrix tmp2, int An); 00030 float BhQhBhT(matrix Qh, float* Bh, float* tmp); 00031 void VectdivSc(float* V, float scl); 00032 00033 /*void allocMatrix(float** mat, int nrows, int ncolumns) 00034 { 00035 mat = (float **)malloc(nrows * ncolumns * sizeof(float)); 00036 00037 float* temp = (float*) malloc(nrows * ncolumns * sizeof(float)); 00038 00039 for(int i = 0; i < nrows; i++) 00040 mat[i] = temp + (i * ncolumns); 00041 00042 }*/ 00043 00044 /*void allocMatrix(float** mat, int nrows, int ncolumns) 00045 { 00046 mat = malloc(ncolumns * sizeof(float*)); 00047 for(int i = 0; i < ncolumns; i++) 00048 mat[i] = malloc(nrows * sizeof(float)); 00049 }*/ 00050 00051 00052 #endif /*MATRICES_H_*/ 00053 00054