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.

csytri_3.f 7.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. *> \brief \b CSYTRI_3
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download CSYTRI_3 + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/csytri_3.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/csytri_3.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/csytri_3.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE CSYTRI_3( UPLO, N, A, LDA, E, IPIV, WORK, LWORK,
  22. * INFO )
  23. *
  24. * .. Scalar Arguments ..
  25. * CHARACTER UPLO
  26. * INTEGER INFO, LDA, LWORK, N
  27. * ..
  28. * .. Array Arguments ..
  29. * INTEGER IPIV( * )
  30. * COMPLEX A( LDA, * ), E( * ), WORK( * )
  31. * ..
  32. *
  33. *
  34. *> \par Purpose:
  35. * =============
  36. *>
  37. *> \verbatim
  38. *> CSYTRI_3 computes the inverse of a complex symmetric indefinite
  39. *> matrix A using the factorization computed by CSYTRF_RK or CSYTRF_BK:
  40. *>
  41. *> A = P*U*D*(U**T)*(P**T) or A = P*L*D*(L**T)*(P**T),
  42. *>
  43. *> where U (or L) is unit upper (or lower) triangular matrix,
  44. *> U**T (or L**T) is the transpose of U (or L), P is a permutation
  45. *> matrix, P**T is the transpose of P, and D is symmetric and block
  46. *> diagonal with 1-by-1 and 2-by-2 diagonal blocks.
  47. *>
  48. *> CSYTRI_3 sets the leading dimension of the workspace before calling
  49. *> CSYTRI_3X that actually computes the inverse. This is the blocked
  50. *> version of the algorithm, calling Level 3 BLAS.
  51. *> \endverbatim
  52. *
  53. * Arguments:
  54. * ==========
  55. *
  56. *> \param[in] UPLO
  57. *> \verbatim
  58. *> UPLO is CHARACTER*1
  59. *> Specifies whether the details of the factorization are
  60. *> stored as an upper or lower triangular matrix.
  61. *> = 'U': Upper triangle of A is stored;
  62. *> = 'L': Lower triangle of A is stored.
  63. *> \endverbatim
  64. *>
  65. *> \param[in] N
  66. *> \verbatim
  67. *> N is INTEGER
  68. *> The order of the matrix A. N >= 0.
  69. *> \endverbatim
  70. *>
  71. *> \param[in,out] A
  72. *> \verbatim
  73. *> A is COMPLEX array, dimension (LDA,N)
  74. *> On entry, diagonal of the block diagonal matrix D and
  75. *> factors U or L as computed by CSYTRF_RK and CSYTRF_BK:
  76. *> a) ONLY diagonal elements of the symmetric block diagonal
  77. *> matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
  78. *> (superdiagonal (or subdiagonal) elements of D
  79. *> should be provided on entry in array E), and
  80. *> b) If UPLO = 'U': factor U in the superdiagonal part of A.
  81. *> If UPLO = 'L': factor L in the subdiagonal part of A.
  82. *>
  83. *> On exit, if INFO = 0, the symmetric inverse of the original
  84. *> matrix.
  85. *> If UPLO = 'U': the upper triangular part of the inverse
  86. *> is formed and the part of A below the diagonal is not
  87. *> referenced;
  88. *> If UPLO = 'L': the lower triangular part of the inverse
  89. *> is formed and the part of A above the diagonal is not
  90. *> referenced.
  91. *> \endverbatim
  92. *>
  93. *> \param[in] LDA
  94. *> \verbatim
  95. *> LDA is INTEGER
  96. *> The leading dimension of the array A. LDA >= max(1,N).
  97. *> \endverbatim
  98. *>
  99. *> \param[in] E
  100. *> \verbatim
  101. *> E is COMPLEX array, dimension (N)
  102. *> On entry, contains the superdiagonal (or subdiagonal)
  103. *> elements of the symmetric block diagonal matrix D
  104. *> with 1-by-1 or 2-by-2 diagonal blocks, where
  105. *> If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not referenced;
  106. *> If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced.
  107. *>
  108. *> NOTE: For 1-by-1 diagonal block D(k), where
  109. *> 1 <= k <= N, the element E(k) is not referenced in both
  110. *> UPLO = 'U' or UPLO = 'L' cases.
  111. *> \endverbatim
  112. *>
  113. *> \param[in] IPIV
  114. *> \verbatim
  115. *> IPIV is INTEGER array, dimension (N)
  116. *> Details of the interchanges and the block structure of D
  117. *> as determined by CSYTRF_RK or CSYTRF_BK.
  118. *> \endverbatim
  119. *>
  120. *> \param[out] WORK
  121. *> \verbatim
  122. *> WORK is COMPLEX array, dimension (N+NB+1)*(NB+3).
  123. *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  124. *> \endverbatim
  125. *>
  126. *> \param[in] LWORK
  127. *> \verbatim
  128. *> LWORK is INTEGER
  129. *> The length of WORK. LWORK >= (N+NB+1)*(NB+3).
  130. *>
  131. *> If LDWORK = -1, then a workspace query is assumed;
  132. *> the routine only calculates the optimal size of the optimal
  133. *> size of the WORK array, returns this value as the first
  134. *> entry of the WORK array, and no error message related to
  135. *> LWORK is issued by XERBLA.
  136. *> \endverbatim
  137. *>
  138. *> \param[out] INFO
  139. *> \verbatim
  140. *> INFO is INTEGER
  141. *> = 0: successful exit
  142. *> < 0: if INFO = -i, the i-th argument had an illegal value
  143. *> > 0: if INFO = i, D(i,i) = 0; the matrix is singular and its
  144. *> inverse could not be computed.
  145. *> \endverbatim
  146. *
  147. * Authors:
  148. * ========
  149. *
  150. *> \author Univ. of Tennessee
  151. *> \author Univ. of California Berkeley
  152. *> \author Univ. of Colorado Denver
  153. *> \author NAG Ltd.
  154. *
  155. *> \date November 2017
  156. *
  157. *> \ingroup complexSYcomputational
  158. *
  159. *> \par Contributors:
  160. * ==================
  161. *> \verbatim
  162. *>
  163. *> November 2017, Igor Kozachenko,
  164. *> Computer Science Division,
  165. *> University of California, Berkeley
  166. *>
  167. *> \endverbatim
  168. *
  169. * =====================================================================
  170. SUBROUTINE CSYTRI_3( UPLO, N, A, LDA, E, IPIV, WORK, LWORK,
  171. $ INFO )
  172. *
  173. * -- LAPACK computational routine (version 3.8.0) --
  174. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  175. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  176. * November 2017
  177. *
  178. * .. Scalar Arguments ..
  179. CHARACTER UPLO
  180. INTEGER INFO, LDA, LWORK, N
  181. * ..
  182. * .. Array Arguments ..
  183. INTEGER IPIV( * )
  184. COMPLEX A( LDA, * ), E( * ), WORK( * )
  185. * ..
  186. *
  187. * =====================================================================
  188. *
  189. * .. Local Scalars ..
  190. LOGICAL UPPER, LQUERY
  191. INTEGER LWKOPT, NB
  192. * ..
  193. * .. External Functions ..
  194. LOGICAL LSAME
  195. INTEGER ILAENV
  196. EXTERNAL LSAME, ILAENV
  197. * ..
  198. * .. External Subroutines ..
  199. EXTERNAL CSYTRI_3X, XERBLA
  200. * ..
  201. * .. Intrinsic Functions ..
  202. INTRINSIC MAX
  203. * ..
  204. * .. Executable Statements ..
  205. *
  206. * Test the input parameters.
  207. *
  208. INFO = 0
  209. UPPER = LSAME( UPLO, 'U' )
  210. LQUERY = ( LWORK.EQ.-1 )
  211. *
  212. * Determine the block size
  213. *
  214. NB = MAX( 1, ILAENV( 1, 'CSYTRI_3', UPLO, N, -1, -1, -1 ) )
  215. LWKOPT = ( N+NB+1 ) * ( NB+3 )
  216. *
  217. IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
  218. INFO = -1
  219. ELSE IF( N.LT.0 ) THEN
  220. INFO = -2
  221. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  222. INFO = -4
  223. ELSE IF ( LWORK .LT. LWKOPT .AND. .NOT.LQUERY ) THEN
  224. INFO = -8
  225. END IF
  226. *
  227. IF( INFO.NE.0 ) THEN
  228. CALL XERBLA( 'CSYTRI_3', -INFO )
  229. RETURN
  230. ELSE IF( LQUERY ) THEN
  231. WORK( 1 ) = LWKOPT
  232. RETURN
  233. END IF
  234. *
  235. * Quick return if possible
  236. *
  237. IF( N.EQ.0 )
  238. $ RETURN
  239. *
  240. CALL CSYTRI_3X( UPLO, N, A, LDA, E, IPIV, WORK, NB, INFO )
  241. *
  242. WORK( 1 ) = LWKOPT
  243. *
  244. RETURN
  245. *
  246. * End of CSYTRI_3
  247. *
  248. END