sossol.f 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. *DECK SOSSOL
  2. SUBROUTINE SOSSOL (K, N, L, X, C, B, M)
  3. C***BEGIN PROLOGUE SOSSOL
  4. C***SUBSIDIARY
  5. C***PURPOSE Subsidiary to SOS
  6. C***LIBRARY SLATEC
  7. C***TYPE SINGLE PRECISION (SOSSOL-S, DSOSSL-D)
  8. C***AUTHOR (UNKNOWN)
  9. C***DESCRIPTION
  10. C
  11. C SOSSOL solves an upper triangular type of linear system by back
  12. C substitution.
  13. C
  14. C The matrix C is upper trapezoidal and stored as a linear array by
  15. C rows. The equations have been normalized so that the diagonal
  16. C entries of C are understood to be unity. The off diagonal entries
  17. C and the elements of the constant right hand side vector B have
  18. C already been stored as the negatives of the corresponding equation
  19. C values.
  20. C with each call to SOSSOL a (K-1) by (K-1) triangular system is
  21. C resolved. For L greater than K, column L of C is included in the
  22. C right hand side vector.
  23. C
  24. C***SEE ALSO SOS
  25. C***ROUTINES CALLED (NONE)
  26. C***REVISION HISTORY (YYMMDD)
  27. C 801001 DATE WRITTEN
  28. C 890831 Modified array declarations. (WRB)
  29. C 891214 Prologue converted to Version 4.0 format. (BAB)
  30. C 900328 Added TYPE section. (WRB)
  31. C***END PROLOGUE SOSSOL
  32. C
  33. C
  34. DIMENSION X(*), C(*), B(*)
  35. C
  36. C***FIRST EXECUTABLE STATEMENT SOSSOL
  37. NP1 = N + 1
  38. KM1 = K - 1
  39. LK = KM1
  40. IF (L .EQ. K) LK = K
  41. KN = M
  42. C
  43. C
  44. DO 40 KJ=1,KM1
  45. KMM1 = K - KJ
  46. KM = KMM1 + 1
  47. XMAX = 0.
  48. KN = KN - NP1 + KMM1
  49. IF (KM .GT. LK) GO TO 20
  50. JKM = KN
  51. C
  52. DO 10 J=KM,LK
  53. JKM = JKM + 1
  54. XMAX = XMAX + C(JKM)*X(J)
  55. 10 CONTINUE
  56. C
  57. 20 IF (L .LE. K) GO TO 30
  58. JKM = KN + L - KMM1
  59. XMAX = XMAX + C(JKM)*X(L)
  60. 30 X(KMM1) = XMAX + B(KMM1)
  61. 40 CONTINUE
  62. C
  63. RETURN
  64. END