You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dptts2.f 4.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. *> \brief \b DPTTS2 solves a tridiagonal system of the form AX=B using the L D LH factorization computed by spttrf.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download DPTTS2 + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dptts2.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dptts2.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dptts2.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE DPTTS2( N, NRHS, D, E, B, LDB )
  22. *
  23. * .. Scalar Arguments ..
  24. * INTEGER LDB, N, NRHS
  25. * ..
  26. * .. Array Arguments ..
  27. * DOUBLE PRECISION B( LDB, * ), D( * ), E( * )
  28. * ..
  29. *
  30. *
  31. *> \par Purpose:
  32. * =============
  33. *>
  34. *> \verbatim
  35. *>
  36. *> DPTTS2 solves a tridiagonal system of the form
  37. *> A * X = B
  38. *> using the L*D*L**T factorization of A computed by DPTTRF. D is a
  39. *> diagonal matrix specified in the vector D, L is a unit bidiagonal
  40. *> matrix whose subdiagonal is specified in the vector E, and X and B
  41. *> are N by NRHS matrices.
  42. *> \endverbatim
  43. *
  44. * Arguments:
  45. * ==========
  46. *
  47. *> \param[in] N
  48. *> \verbatim
  49. *> N is INTEGER
  50. *> The order of the tridiagonal matrix A. N >= 0.
  51. *> \endverbatim
  52. *>
  53. *> \param[in] NRHS
  54. *> \verbatim
  55. *> NRHS is INTEGER
  56. *> The number of right hand sides, i.e., the number of columns
  57. *> of the matrix B. NRHS >= 0.
  58. *> \endverbatim
  59. *>
  60. *> \param[in] D
  61. *> \verbatim
  62. *> D is DOUBLE PRECISION array, dimension (N)
  63. *> The n diagonal elements of the diagonal matrix D from the
  64. *> L*D*L**T factorization of A.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] E
  68. *> \verbatim
  69. *> E is DOUBLE PRECISION array, dimension (N-1)
  70. *> The (n-1) subdiagonal elements of the unit bidiagonal factor
  71. *> L from the L*D*L**T factorization of A. E can also be regarded
  72. *> as the superdiagonal of the unit bidiagonal factor U from the
  73. *> factorization A = U**T*D*U.
  74. *> \endverbatim
  75. *>
  76. *> \param[in,out] B
  77. *> \verbatim
  78. *> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
  79. *> On entry, the right hand side vectors B for the system of
  80. *> linear equations.
  81. *> On exit, the solution vectors, X.
  82. *> \endverbatim
  83. *>
  84. *> \param[in] LDB
  85. *> \verbatim
  86. *> LDB is INTEGER
  87. *> The leading dimension of the array B. LDB >= max(1,N).
  88. *> \endverbatim
  89. *
  90. * Authors:
  91. * ========
  92. *
  93. *> \author Univ. of Tennessee
  94. *> \author Univ. of California Berkeley
  95. *> \author Univ. of Colorado Denver
  96. *> \author NAG Ltd.
  97. *
  98. *> \date September 2012
  99. *
  100. *> \ingroup doublePTcomputational
  101. *
  102. * =====================================================================
  103. SUBROUTINE DPTTS2( N, NRHS, D, E, B, LDB )
  104. *
  105. * -- LAPACK computational routine (version 3.4.2) --
  106. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  107. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  108. * September 2012
  109. *
  110. * .. Scalar Arguments ..
  111. INTEGER LDB, N, NRHS
  112. * ..
  113. * .. Array Arguments ..
  114. DOUBLE PRECISION B( LDB, * ), D( * ), E( * )
  115. * ..
  116. *
  117. * =====================================================================
  118. *
  119. * .. Local Scalars ..
  120. INTEGER I, J
  121. * ..
  122. * .. External Subroutines ..
  123. EXTERNAL DSCAL
  124. * ..
  125. * .. Executable Statements ..
  126. *
  127. * Quick return if possible
  128. *
  129. IF( N.LE.1 ) THEN
  130. IF( N.EQ.1 )
  131. $ CALL DSCAL( NRHS, 1.D0 / D( 1 ), B, LDB )
  132. RETURN
  133. END IF
  134. *
  135. * Solve A * X = B using the factorization A = L*D*L**T,
  136. * overwriting each right hand side vector with its solution.
  137. *
  138. DO 30 J = 1, NRHS
  139. *
  140. * Solve L * x = b.
  141. *
  142. DO 10 I = 2, N
  143. B( I, J ) = B( I, J ) - B( I-1, J )*E( I-1 )
  144. 10 CONTINUE
  145. *
  146. * Solve D * L**T * x = b.
  147. *
  148. B( N, J ) = B( N, J ) / D( N )
  149. DO 20 I = N - 1, 1, -1
  150. B( I, J ) = B( I, J ) / D( I ) - B( I+1, J )*E( I )
  151. 20 CONTINUE
  152. 30 CONTINUE
  153. *
  154. RETURN
  155. *
  156. * End of DPTTS2
  157. *
  158. END