File: linalg.h

package info (click to toggle)
libhmsbeagle 4.0.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 46,436 kB
  • sloc: xml: 133,356; cpp: 36,477; ansic: 5,842; java: 2,400; python: 643; sh: 338; makefile: 50
file content (40 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*	linalg.h
|
|	Prototypes for matrix-inversion and eigensystem functions
|
|	Copyright (c) 1998 by David L. Swofford, Smithsonian Institution.
|	All rights reserved.
|
|	NOTE: if ANSI function prototypes are not supported, define NO_PROTOTYPES
|		  before including this file.
*/

#define RC_COMPLEX_EVAL 2	/* code that complex eigenvalue obtained */

extern int  InvertMatrix (double **a, int n, double *col, int *indx, double **a_inv);
extern int  LUDecompose (double **a, int n, double *vv, int *indx, double *pd);
int  EigenRealGeneral (int n, double **a, double *v, double *vi, double **u, int *iwork, double *work);


template<typename T> T **New2DArray(unsigned f , unsigned s)
{
	T **temp;
	temp = new T *[f];
	*temp = new T [f * s];
	for (unsigned fIt = 1 ; fIt < f ; fIt ++)
		temp[fIt] = temp[fIt -1] +  s ;
	return temp;
}

/*--------------------------------------------------------------------------------------------------------------------------
 | Delete a 2 Dimensional Array New2DArray
 */
template<typename T> inline void Delete2DArray	(T **temp)
{
	if (temp)
    {
		if (*temp)
			delete [] * temp;
		delete [] temp;
    }
}