HMSBEAGLE  1.0.0
linalg.h
1 /* linalg.h
2 |
3 | Prototypes for matrix-inversion and eigensystem functions
4 |
5 | Copyright (c) 1998 by David L. Swofford, Smithsonian Institution.
6 | All rights reserved.
7 |
8 | NOTE: if ANSI function prototypes are not supported, define NO_PROTOTYPES
9 | before including this file.
10 */
11 
12 #define RC_COMPLEX_EVAL 2 /* code that complex eigenvalue obtained */
13 
14 extern int InvertMatrix (double **a, int n, double *col, int *indx, double **a_inv);
15 extern int LUDecompose (double **a, int n, double *vv, int *indx, double *pd);
16 int EigenRealGeneral (int n, double **a, double *v, double *vi, double **u, int *iwork, double *work);
17 
18 
19 template<typename T> T **New2DArray(unsigned f , unsigned s)
20 {
21  T **temp;
22  temp = new T *[f];
23  *temp = new T [f * s];
24  for (unsigned fIt = 1 ; fIt < f ; fIt ++)
25  temp[fIt] = temp[fIt -1] + s ;
26  return temp;
27 }
28 
29 /*--------------------------------------------------------------------------------------------------------------------------
30  | Delete a 2 Dimensional Array New2DArray
31  */
32 template<typename T> inline void Delete2DArray (T **temp)
33 {
34  if (temp)
35  {
36  if (*temp)
37  delete [] * temp;
38  delete [] temp;
39  }
40 }