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.

cpotrf.f 6.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. C> \brief \b CPOTRF VARIANT: top-looking block version of the algorithm, calling Level 3 BLAS.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * SUBROUTINE CPOTRF ( UPLO, N, A, LDA, INFO )
  12. *
  13. * .. Scalar Arguments ..
  14. * CHARACTER UPLO
  15. * INTEGER INFO, LDA, N
  16. * ..
  17. * .. Array Arguments ..
  18. * COMPLEX A( LDA, * )
  19. * ..
  20. *
  21. * Purpose
  22. * =======
  23. *
  24. C>\details \b Purpose:
  25. C>\verbatim
  26. C>
  27. C> CPOTRF computes the Cholesky factorization of a complex Hermitian
  28. C> positive definite matrix A.
  29. C>
  30. C> The factorization has the form
  31. C> A = U**H * U, if UPLO = 'U', or
  32. C> A = L * L**H, if UPLO = 'L',
  33. C> where U is an upper triangular matrix and L is lower triangular.
  34. C>
  35. C> This is the top-looking block version of the algorithm, calling Level 3 BLAS.
  36. C>
  37. C>\endverbatim
  38. *
  39. * Arguments:
  40. * ==========
  41. *
  42. C> \param[in] UPLO
  43. C> \verbatim
  44. C> UPLO is CHARACTER*1
  45. C> = 'U': Upper triangle of A is stored;
  46. C> = 'L': Lower triangle of A is stored.
  47. C> \endverbatim
  48. C>
  49. C> \param[in] N
  50. C> \verbatim
  51. C> N is INTEGER
  52. C> The order of the matrix A. N >= 0.
  53. C> \endverbatim
  54. C>
  55. C> \param[in,out] A
  56. C> \verbatim
  57. C> A is COMPLEX array, dimension (LDA,N)
  58. C> On entry, the Hermitian matrix A. If UPLO = 'U', the leading
  59. C> N-by-N upper triangular part of A contains the upper
  60. C> triangular part of the matrix A, and the strictly lower
  61. C> triangular part of A is not referenced. If UPLO = 'L', the
  62. C> leading N-by-N lower triangular part of A contains the lower
  63. C> triangular part of the matrix A, and the strictly upper
  64. C> triangular part of A is not referenced.
  65. C> \endverbatim
  66. C> \verbatim
  67. C> On exit, if INFO = 0, the factor U or L from the Cholesky
  68. C> factorization A = U**H*U or A = L*L**H.
  69. C> \endverbatim
  70. C>
  71. C> \param[in] LDA
  72. C> \verbatim
  73. C> LDA is INTEGER
  74. C> The leading dimension of the array A. LDA >= max(1,N).
  75. C> \endverbatim
  76. C>
  77. C> \param[out] INFO
  78. C> \verbatim
  79. C> INFO is INTEGER
  80. C> = 0: successful exit
  81. C> < 0: if INFO = -i, the i-th argument had an illegal value
  82. C> > 0: if INFO = i, the leading principal minor of order i
  83. C> is not positive, and the factorization could not be
  84. C> completed.
  85. C> \endverbatim
  86. C>
  87. *
  88. * Authors:
  89. * ========
  90. *
  91. C> \author Univ. of Tennessee
  92. C> \author Univ. of California Berkeley
  93. C> \author Univ. of Colorado Denver
  94. C> \author NAG Ltd.
  95. *
  96. C> \date December 2016
  97. *
  98. C> \ingroup variantsPOcomputational
  99. *
  100. * =====================================================================
  101. SUBROUTINE CPOTRF ( UPLO, N, A, LDA, INFO )
  102. *
  103. * -- LAPACK computational routine --
  104. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  105. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  106. *
  107. * .. Scalar Arguments ..
  108. CHARACTER UPLO
  109. INTEGER INFO, LDA, N
  110. * ..
  111. * .. Array Arguments ..
  112. COMPLEX A( LDA, * )
  113. * ..
  114. *
  115. * =====================================================================
  116. *
  117. * .. Parameters ..
  118. REAL ONE
  119. COMPLEX CONE
  120. PARAMETER ( ONE = 1.0E+0, CONE = ( 1.0E+0, 0.0E+0 ) )
  121. * ..
  122. * .. Local Scalars ..
  123. LOGICAL UPPER
  124. INTEGER J, JB, NB
  125. * ..
  126. * .. External Functions ..
  127. LOGICAL LSAME
  128. INTEGER ILAENV
  129. EXTERNAL LSAME, ILAENV
  130. * ..
  131. * .. External Subroutines ..
  132. EXTERNAL CGEMM, CPOTF2, CHERK, CTRSM, XERBLA
  133. * ..
  134. * .. Intrinsic Functions ..
  135. INTRINSIC MAX, MIN
  136. * ..
  137. * .. Executable Statements ..
  138. *
  139. * Test the input parameters.
  140. *
  141. INFO = 0
  142. UPPER = LSAME( UPLO, 'U' )
  143. IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
  144. INFO = -1
  145. ELSE IF( N.LT.0 ) THEN
  146. INFO = -2
  147. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  148. INFO = -4
  149. END IF
  150. IF( INFO.NE.0 ) THEN
  151. CALL XERBLA( 'CPOTRF', -INFO )
  152. RETURN
  153. END IF
  154. *
  155. * Quick return if possible
  156. *
  157. IF( N.EQ.0 )
  158. $ RETURN
  159. *
  160. * Determine the block size for this environment.
  161. *
  162. NB = ILAENV( 1, 'CPOTRF', UPLO, N, -1, -1, -1 )
  163. IF( NB.LE.1 .OR. NB.GE.N ) THEN
  164. *
  165. * Use unblocked code.
  166. *
  167. CALL CPOTF2( UPLO, N, A, LDA, INFO )
  168. ELSE
  169. *
  170. * Use blocked code.
  171. *
  172. IF( UPPER ) THEN
  173. *
  174. * Compute the Cholesky factorization A = U'*U.
  175. *
  176. DO 10 J = 1, N, NB
  177. JB = MIN( NB, N-J+1 )
  178. *
  179. * Compute the current block.
  180. *
  181. CALL CTRSM( 'Left', 'Upper', 'Conjugate Transpose',
  182. $ 'Non-unit', J-1, JB, CONE, A( 1, 1 ), LDA,
  183. $ A( 1, J ), LDA )
  184. CALL CHERK( 'Upper', 'Conjugate Transpose', JB, J-1,
  185. $ -ONE, A( 1, J ), LDA, ONE, A( J, J ), LDA )
  186. *
  187. * Update and factorize the current diagonal block and test
  188. * for non-positive-definiteness.
  189. *
  190. CALL CPOTF2( 'Upper', JB, A( J, J ), LDA, INFO )
  191. IF( INFO.NE.0 )
  192. $ GO TO 30
  193. 10 CONTINUE
  194. *
  195. ELSE
  196. *
  197. * Compute the Cholesky factorization A = L*L'.
  198. *
  199. DO 20 J = 1, N, NB
  200. JB = MIN( NB, N-J+1 )
  201. *
  202. * Compute the current block.
  203. *
  204. CALL CTRSM( 'Right', 'Lower', 'Conjugate Transpose',
  205. $ 'Non-unit', JB, J-1, CONE, A( 1, 1 ), LDA,
  206. $ A( J, 1 ), LDA )
  207. CALL CHERK( 'Lower', 'No Transpose', JB, J-1,
  208. $ -ONE, A( J, 1 ), LDA,
  209. $ ONE, A( J, J ), LDA )
  210. *
  211. * Update and factorize the current diagonal block and test
  212. * for non-positive-definiteness.
  213. *
  214. CALL CPOTF2( 'Lower', JB, A( J, J ), LDA, INFO )
  215. IF( INFO.NE.0 )
  216. $ GO TO 30
  217. 20 CONTINUE
  218. END IF
  219. END IF
  220. GO TO 40
  221. *
  222. 30 CONTINUE
  223. INFO = INFO + J - 1
  224. *
  225. 40 CONTINUE
  226. RETURN
  227. *
  228. * End of CPOTRF
  229. *
  230. END