GRASS Programmer's Manual  6.5.svn(2012)-r51648
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
solvtd.c
Go to the documentation of this file.
00001 /*  solvtd.c    CCMATH mathematics library source code.
00002  *
00003  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
00004  *  This code may be redistributed under the terms of the GNU library
00005  *  public license (LGPL). ( See the lgpl.license file for details.)
00006  * ------------------------------------------------------------------------
00007  */
00008 void solvtd(double *a, double *b, double *c, double *x, int m)
00009 {
00010     double s;
00011 
00012     int j;
00013 
00014     for (j = 0; j < m; ++j) {
00015         s = b[j] / a[j];
00016         a[j + 1] -= s * c[j];
00017         x[j + 1] -= s * x[j];
00018     }
00019     for (j = m, s = 0.; j >= 0; --j) {
00020         x[j] -= s * c[j];
00021         s = (x[j] /= a[j]);
00022     }
00023 }