Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

csuCommonMatrix.h

Go to the documentation of this file.
00001 #ifndef MATRIX_INCLUDED
00002 #define MATRIX_INCLUDED
00003 
00004 #include "csuCommon.h"
00005 
00006 namespace csu{
00007 typedef struct {
00008     int row_dim;  
00009     int col_dim;  
00010     FTYPE *data;    
00011     FTYPE **cols;
00012 }
00013 matrix;
00014 
00015 typedef matrix* Matrix;
00016 
00017 Matrix makeMatrix(int row_dim, int col_dim);        
00018 void freeMatrix(Matrix A);                        
00020 Matrix makeZeroMatrix(int row_dim, int col_dim);       
00021 Matrix makeIdentityMatrix(int dim);           
00039 /* #define MATRIX_RANGE_CHECK */
00040 #ifdef MATRIX_RANGE_CHECK
00041 #define  ME( mat , i , j )  ( ( rangeCheck(mat,i,j,__FILE__,__FUNCTION__,__LINE__,#mat))->cols[j][i] )
00042 #else
00043 #define  ME( mat , i , j )  ( (mat)->cols[j][i] )
00044 #endif
00045 
00046 Matrix rangeCheck(Matrix mat, int i, int j, const char* file_name, const char* func_name, int line_num, const char* mat_name);
00047 
00049 Matrix multiplyMatrix (const Matrix A, const Matrix B);
00051 Matrix transposeMultiplyMatrixL (const Matrix A, const Matrix B);
00053 Matrix transposeMultiplyMatrixR (const Matrix A, const Matrix B);
00054 
00056 Matrix subtractMatrix (const Matrix A, const Matrix B);
00058 Matrix addMatrix (const Matrix A, const Matrix B);
00060 void addMatrixEquals ( Matrix A, const Matrix B);
00061 
00063 Matrix transposeMatrix(const Matrix A);
00064 
00066 Matrix invertRREF(Matrix);
00067 
00069 Matrix matrixCols(const Matrix mat, int col1, int col2);
00070 
00072 Matrix duplicateMatrix(const Matrix mat);
00073 
00074 typedef enum {
00075   octaveFormat = 0x00,
00076   matlabFormat = 0x01,
00077   appendToFile = 0x02,
00078 
00079   formatMask   = 0x01
00080 } MatrixSaveMode;
00081 
00082 extern int asciiFormat;  
00083 #define  SAVE_MATRIX( mat )  saveMatrixAscii(NULL, #mat, mat, asciiFormat) 
00084 /* saves a matrix to an octive file */
00085 void saveMatrixAscii(const char *fname, const char* label, const Matrix m, MatrixSaveMode format);
00086 
00088 Matrix makeRandomMatrix (int row_dim, int col_dim);
00089 
00091 FTYPE matrixSumOfSquares (Matrix mat);
00092 
00093 void printMatrix(const char* label, Matrix m);
00094 }
00095 #endif

Generated on Wed Apr 23 10:42:33 2003 for BioFilter by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002