solvtd.c 626 B

123456789101112131415161718192021222324
  1. /* solvtd.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. void solvtd(double *a, double *b, double *c, double *x, int m)
  9. {
  10. double s;
  11. int j;
  12. for (j = 0; j < m; ++j) {
  13. s = b[j] / a[j];
  14. a[j + 1] -= s * c[j];
  15. x[j + 1] -= s * x[j];
  16. }
  17. for (j = m, s = 0.; j >= 0; --j) {
  18. x[j] -= s * c[j];
  19. s = (x[j] /= a[j]);
  20. }
  21. }