GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 }
float b
Definition: named_colr.c:8
tuple q
Definition: forms.py:2019
int solvru(double *a, double *b, int n)
Definition: solvru.c:8
int n
Definition: dataquad.c:291