HMSBEAGLE
1.0.0
|
00001 /* linalg.h 00002 | 00003 | Prototypes for matrix-inversion and eigensystem functions 00004 | 00005 | Copyright (c) 1998 by David L. Swofford, Smithsonian Institution. 00006 | All rights reserved. 00007 | 00008 | NOTE: if ANSI function prototypes are not supported, define NO_PROTOTYPES 00009 | before including this file. 00010 */ 00011 00012 #define RC_COMPLEX_EVAL 2 /* code that complex eigenvalue obtained */ 00013 00014 extern int InvertMatrix (double **a, int n, double *col, int *indx, double **a_inv); 00015 extern int LUDecompose (double **a, int n, double *vv, int *indx, double *pd); 00016 int EigenRealGeneral (int n, double **a, double *v, double *vi, double **u, int *iwork, double *work); 00017 00018 00019 template<typename T> T **New2DArray(unsigned f , unsigned s) 00020 { 00021 T **temp; 00022 temp = new T *[f]; 00023 *temp = new T [f * s]; 00024 for (unsigned fIt = 1 ; fIt < f ; fIt ++) 00025 temp[fIt] = temp[fIt -1] + s ; 00026 return temp; 00027 } 00028 00029 /*-------------------------------------------------------------------------------------------------------------------------- 00030 | Delete a 2 Dimensional Array New2DArray 00031 */ 00032 template<typename T> inline void Delete2DArray (T **temp) 00033 { 00034 if (temp) 00035 { 00036 if (*temp) 00037 delete [] * temp; 00038 delete [] temp; 00039 } 00040 }