OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
ludcmp.c
Go to the documentation of this file.
1 
2 #include <math.h>
3 #define NRANSI
4 #include "nrutil.h"
5 #define TINY 1.0e-20
6 
7 void ludcmp(float **a, int n, int *indx, float *d) {
8  int i, imax, j, k;
9  float big, dum, sum, temp;
10  float *vv;
11 
12  vv = vector(1, n);
13  *d = 1.0;
14  for (i = 1; i <= n; i++) {
15  big = 0.0;
16  for (j = 1; j <= n; j++)
17  if ((temp = fabs(a[i][j])) > big) big = temp;
18  if (big == 0.0) nrerror("Singular matrix in routine ludcmp");
19  vv[i] = 1.0 / big;
20  }
21  for (j = 1; j <= n; j++) {
22  for (i = 1; i < j; i++) {
23  sum = a[i][j];
24  for (k = 1; k < i; k++) sum -= a[i][k] * a[k][j];
25  a[i][j] = sum;
26  }
27  big = 0.0;
28  for (i = j; i <= n; i++) {
29  sum = a[i][j];
30  for (k = 1; k < j; k++)
31  sum -= a[i][k] * a[k][j];
32  a[i][j] = sum;
33  if ((dum = vv[i] * fabs(sum)) >= big) {
34  big = dum;
35  imax = i;
36  }
37  }
38  if (j != imax) {
39  for (k = 1; k <= n; k++) {
40  dum = a[imax][k];
41  a[imax][k] = a[j][k];
42  a[j][k] = dum;
43  }
44  *d = -(*d);
45  vv[imax] = vv[j];
46  }
47  indx[j] = imax;
48  if (a[j][j] == 0.0) a[j][j] = TINY;
49  if (j != n) {
50  dum = 1.0 / (a[j][j]);
51  for (i = j + 1; i <= n; i++) a[i][j] *= dum;
52  }
53  }
54  free_vector(vv, 1, n);
55 }
56 #undef TINY
57 #undef NRANSI
int j
Definition: decode_rs.h:73
float * vector(long nl, long nh)
Definition: nrutil.c:15
void ludcmp(float **a, int n, int *indx, float *d)
Definition: ludcmp.c:7
void nrerror(char error_text[])
Definition: nrutil.c:7
void free_vector(float *v, long nl, long nh)
Definition: nrutil.c:204
#define TINY
Definition: ludcmp.c:5
make_L3 README txt Compiling set environment variables for HDBLIB and HDFINC to the appropriate HDF4 lib and include directories make_L3_v1 c o make_L3 LIB lib a I LIB I $HDFINC L $HDFLIB lmfhdf ldf lz ljpeg lm lmalloc Running make_L3 takes input from standard so the SeaWIFS level files should be piped to the program via the command line as in to be allocated by the program to buffer the compositing The the better Ideally it should be to fit the entire global required because of the skewness of the map projection If the number of lines is too then the compositing process may be slow But if the number of lines is too big
Definition: README.txt:68
#define fabs(a)
Definition: misc.h:93
int i
Definition: decode_rs.h:71
PGE01 indicating that PGE02 PGE01 V6 for and PGE01 V2 for MOD03 were used to produce the granule By convention adopted in all MODIS Terra PGE02 code versions are The fourth digit of the PGE02 version denotes the LUT version used to produce the granule The source of the metadata environment variable ProcessingCenter was changed from a QA LUT value to the Process Configuration A sign used in error in the second order term was changed to a
Definition: HISTORY.txt:424
int k
Definition: decode_rs.h:73