GRASS GIS 8 Programmer's Manual 8.4.1(2025)-45ca3179ab
Loading...
Searching...
No Matches
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 */
8int ruinv(double *a, int n)
9{
10 int j;
11
12 double fabs(double);
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}
double t
double r
int ruinv(double *a, int n)
Definition ruinv.c:8