GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ruinv.c
Go to the documentation of this file.
1 /* ruinv.c CCMATH mathematics library source code.
2  *
3  * Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
4  * This code may be redistributed under the terms of the GNU library
5  * public license (LGPL). ( See the lgpl.license file for details.)
6  * ------------------------------------------------------------------------
7  */
8 int ruinv(double *a, int n)
9 {
10  int j;
11 
12  double fabs();
13 
14  double tt, z, *p, *q, *r, *s, *t;
15 
16  for (j = 0, tt = 0., p = a; j < n; ++j, p += n + 1)
17  if ((z = fabs(*p)) > tt)
18  tt = z;
19  tt *= 1.e-16;
20  for (j = 0, p = a; j < n; ++j, p += n + 1) {
21  if (fabs(*p) < tt)
22  return -1;
23  *p = 1. / *p;
24  for (q = a + j, t = a; q < p; t += n + 1, q += n) {
25  for (s = q, r = t, z = 0.; s < p; s += n)
26  z -= *s * *r++;
27  *q = z * *p;
28  }
29  }
30  return 0;
31 }
tuple q
Definition: forms.py:2019
float r
Definition: named_colr.c:8
int ruinv(double *a, int n)
Definition: ruinv.c:8
int n
Definition: dataquad.c:291