GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
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  */
8 int solvru(double *a, double *b, int n)
9 {
10  int j, k;
11 
12  double fabs();
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 t
Definition: r_raster.c:39
double b
Definition: r_raster.c:39
int solvru(double *a, double *b, int n)
Definition: solvru.c:8