GRASS GIS 8 Programmer's Manual 8.3.2(2024)-exported
Loading...
Searching...
No Matches
solvru.c
Go to the documentation of this file.
1/* solvru.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 solvru(double *a, double *b, int n)
9{
10 int j, k;
11
12 double fabs(double);
13
14 double s, t, *p, *q;
15
16 for (j = 0, s = 0., p = a; j < n; ++j, p += n + 1)
17 if ((t = fabs(*p)) > s)
18 s = t;
19 s *= 1.e-16;
20 for (j = n - 1, p = a + n * n - 1; j >= 0; --j, p -= n + 1) {
21 for (k = j + 1, q = p + 1; k < n;)
22 b[j] -= b[k++] * *q++;
23 if (fabs(*p) < s)
24 return -1;
25 b[j] /= *p;
26 }
27 return 0;
28}
double b
double t
int solvru(double *a, double *b, int n)
Definition solvru.c:8