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.

ztbtrs.f 6.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. *> \brief \b ZTBTRS
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download ZTBTRS + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztbtrs.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztbtrs.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztbtrs.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE ZTBTRS( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, B,
  22. * LDB, INFO )
  23. *
  24. * .. Scalar Arguments ..
  25. * CHARACTER DIAG, TRANS, UPLO
  26. * INTEGER INFO, KD, LDAB, LDB, N, NRHS
  27. * ..
  28. * .. Array Arguments ..
  29. * COMPLEX*16 AB( LDAB, * ), B( LDB, * )
  30. * ..
  31. *
  32. *
  33. *> \par Purpose:
  34. * =============
  35. *>
  36. *> \verbatim
  37. *>
  38. *> ZTBTRS solves a triangular system of the form
  39. *>
  40. *> A * X = B, A**T * X = B, or A**H * X = B,
  41. *>
  42. *> where A is a triangular band matrix of order N, and B is an
  43. *> N-by-NRHS matrix. A check is made to verify that A is nonsingular.
  44. *> \endverbatim
  45. *
  46. * Arguments:
  47. * ==========
  48. *
  49. *> \param[in] UPLO
  50. *> \verbatim
  51. *> UPLO is CHARACTER*1
  52. *> = 'U': A is upper triangular;
  53. *> = 'L': A is lower triangular.
  54. *> \endverbatim
  55. *>
  56. *> \param[in] TRANS
  57. *> \verbatim
  58. *> TRANS is CHARACTER*1
  59. *> Specifies the form of the system of equations:
  60. *> = 'N': A * X = B (No transpose)
  61. *> = 'T': A**T * X = B (Transpose)
  62. *> = 'C': A**H * X = B (Conjugate transpose)
  63. *> \endverbatim
  64. *>
  65. *> \param[in] DIAG
  66. *> \verbatim
  67. *> DIAG is CHARACTER*1
  68. *> = 'N': A is non-unit triangular;
  69. *> = 'U': A is unit triangular.
  70. *> \endverbatim
  71. *>
  72. *> \param[in] N
  73. *> \verbatim
  74. *> N is INTEGER
  75. *> The order of the matrix A. N >= 0.
  76. *> \endverbatim
  77. *>
  78. *> \param[in] KD
  79. *> \verbatim
  80. *> KD is INTEGER
  81. *> The number of superdiagonals or subdiagonals of the
  82. *> triangular band matrix A. KD >= 0.
  83. *> \endverbatim
  84. *>
  85. *> \param[in] NRHS
  86. *> \verbatim
  87. *> NRHS is INTEGER
  88. *> The number of right hand sides, i.e., the number of columns
  89. *> of the matrix B. NRHS >= 0.
  90. *> \endverbatim
  91. *>
  92. *> \param[in] AB
  93. *> \verbatim
  94. *> AB is COMPLEX*16 array, dimension (LDAB,N)
  95. *> The upper or lower triangular band matrix A, stored in the
  96. *> first kd+1 rows of AB. The j-th column of A is stored
  97. *> in the j-th column of the array AB as follows:
  98. *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
  99. *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
  100. *> If DIAG = 'U', the diagonal elements of A are not referenced
  101. *> and are assumed to be 1.
  102. *> \endverbatim
  103. *>
  104. *> \param[in] LDAB
  105. *> \verbatim
  106. *> LDAB is INTEGER
  107. *> The leading dimension of the array AB. LDAB >= KD+1.
  108. *> \endverbatim
  109. *>
  110. *> \param[in,out] B
  111. *> \verbatim
  112. *> B is COMPLEX*16 array, dimension (LDB,NRHS)
  113. *> On entry, the right hand side matrix B.
  114. *> On exit, if INFO = 0, the solution matrix X.
  115. *> \endverbatim
  116. *>
  117. *> \param[in] LDB
  118. *> \verbatim
  119. *> LDB is INTEGER
  120. *> The leading dimension of the array B. LDB >= max(1,N).
  121. *> \endverbatim
  122. *>
  123. *> \param[out] INFO
  124. *> \verbatim
  125. *> INFO is INTEGER
  126. *> = 0: successful exit
  127. *> < 0: if INFO = -i, the i-th argument had an illegal value
  128. *> > 0: if INFO = i, the i-th diagonal element of A is zero,
  129. *> indicating that the matrix is singular and the
  130. *> solutions X have not been computed.
  131. *> \endverbatim
  132. *
  133. * Authors:
  134. * ========
  135. *
  136. *> \author Univ. of Tennessee
  137. *> \author Univ. of California Berkeley
  138. *> \author Univ. of Colorado Denver
  139. *> \author NAG Ltd.
  140. *
  141. *> \ingroup complex16OTHERcomputational
  142. *
  143. * =====================================================================
  144. SUBROUTINE ZTBTRS( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, B,
  145. $ LDB, INFO )
  146. *
  147. * -- LAPACK computational routine --
  148. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  149. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  150. *
  151. * .. Scalar Arguments ..
  152. CHARACTER DIAG, TRANS, UPLO
  153. INTEGER INFO, KD, LDAB, LDB, N, NRHS
  154. * ..
  155. * .. Array Arguments ..
  156. COMPLEX*16 AB( LDAB, * ), B( LDB, * )
  157. * ..
  158. *
  159. * =====================================================================
  160. *
  161. * .. Parameters ..
  162. COMPLEX*16 ZERO
  163. PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )
  164. * ..
  165. * .. Local Scalars ..
  166. LOGICAL NOUNIT, UPPER
  167. INTEGER J
  168. * ..
  169. * .. External Functions ..
  170. LOGICAL LSAME
  171. EXTERNAL LSAME
  172. * ..
  173. * .. External Subroutines ..
  174. EXTERNAL XERBLA, ZTBSV
  175. * ..
  176. * .. Intrinsic Functions ..
  177. INTRINSIC MAX
  178. * ..
  179. * .. Executable Statements ..
  180. *
  181. * Test the input parameters.
  182. *
  183. INFO = 0
  184. NOUNIT = LSAME( DIAG, 'N' )
  185. UPPER = LSAME( UPLO, 'U' )
  186. IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
  187. INFO = -1
  188. ELSE IF( .NOT.LSAME( TRANS, 'N' ) .AND. .NOT.
  189. $ LSAME( TRANS, 'T' ) .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN
  190. INFO = -2
  191. ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
  192. INFO = -3
  193. ELSE IF( N.LT.0 ) THEN
  194. INFO = -4
  195. ELSE IF( KD.LT.0 ) THEN
  196. INFO = -5
  197. ELSE IF( NRHS.LT.0 ) THEN
  198. INFO = -6
  199. ELSE IF( LDAB.LT.KD+1 ) THEN
  200. INFO = -8
  201. ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  202. INFO = -10
  203. END IF
  204. IF( INFO.NE.0 ) THEN
  205. CALL XERBLA( 'ZTBTRS', -INFO )
  206. RETURN
  207. END IF
  208. *
  209. * Quick return if possible
  210. *
  211. IF( N.EQ.0 )
  212. $ RETURN
  213. *
  214. * Check for singularity.
  215. *
  216. IF( NOUNIT ) THEN
  217. IF( UPPER ) THEN
  218. DO 10 INFO = 1, N
  219. IF( AB( KD+1, INFO ).EQ.ZERO )
  220. $ RETURN
  221. 10 CONTINUE
  222. ELSE
  223. DO 20 INFO = 1, N
  224. IF( AB( 1, INFO ).EQ.ZERO )
  225. $ RETURN
  226. 20 CONTINUE
  227. END IF
  228. END IF
  229. INFO = 0
  230. *
  231. * Solve A * X = B, A**T * X = B, or A**H * X = B.
  232. *
  233. DO 30 J = 1, NRHS
  234. CALL ZTBSV( UPLO, TRANS, DIAG, N, KD, AB, LDAB, B( 1, J ), 1 )
  235. 30 CONTINUE
  236. *
  237. RETURN
  238. *
  239. * End of ZTBTRS
  240. *
  241. END