LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ cpotf2()

subroutine cpotf2 ( character  UPLO,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
integer  INFO 
)

CPOTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite matrix (unblocked algorithm).

Download CPOTF2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 CPOTF2 computes the Cholesky factorization of a complex Hermitian
 positive definite matrix A.

 The factorization has the form
    A = U**H * U ,  if UPLO = 'U', or
    A = L  * L**H,  if UPLO = 'L',
 where U is an upper triangular matrix and L is lower triangular.

 This is the unblocked version of the algorithm, calling Level 2 BLAS.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          Hermitian matrix A is stored.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is COMPLEX array, dimension (LDA,N)
          On entry, the Hermitian matrix A.  If UPLO = 'U', the leading
          n by n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n by n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, if INFO = 0, the factor U or L from the Cholesky
          factorization A = U**H *U  or A = L*L**H.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -k, the k-th argument had an illegal value
          > 0: if INFO = k, the leading minor of order k is not
               positive definite, and the factorization could not be
               completed.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 108 of file cpotf2.f.

109 *
110 * -- LAPACK computational routine --
111 * -- LAPACK is a software package provided by Univ. of Tennessee, --
112 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
113 *
114 * .. Scalar Arguments ..
115  CHARACTER UPLO
116  INTEGER INFO, LDA, N
117 * ..
118 * .. Array Arguments ..
119  COMPLEX A( LDA, * )
120 * ..
121 *
122 * =====================================================================
123 *
124 * .. Parameters ..
125  REAL ONE, ZERO
126  parameter( one = 1.0e+0, zero = 0.0e+0 )
127  COMPLEX CONE
128  parameter( cone = ( 1.0e+0, 0.0e+0 ) )
129 * ..
130 * .. Local Scalars ..
131  LOGICAL UPPER
132  INTEGER J
133  REAL AJJ
134 * ..
135 * .. External Functions ..
136  LOGICAL LSAME, SISNAN
137  COMPLEX CDOTC
138  EXTERNAL lsame, cdotc, sisnan
139 * ..
140 * .. External Subroutines ..
141  EXTERNAL cgemv, clacgv, csscal, xerbla
142 * ..
143 * .. Intrinsic Functions ..
144  INTRINSIC max, real, sqrt
145 * ..
146 * .. Executable Statements ..
147 *
148 * Test the input parameters.
149 *
150  info = 0
151  upper = lsame( uplo, 'U' )
152  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
153  info = -1
154  ELSE IF( n.LT.0 ) THEN
155  info = -2
156  ELSE IF( lda.LT.max( 1, n ) ) THEN
157  info = -4
158  END IF
159  IF( info.NE.0 ) THEN
160  CALL xerbla( 'CPOTF2', -info )
161  RETURN
162  END IF
163 *
164 * Quick return if possible
165 *
166  IF( n.EQ.0 )
167  $ RETURN
168 *
169  IF( upper ) THEN
170 *
171 * Compute the Cholesky factorization A = U**H *U.
172 *
173  DO 10 j = 1, n
174 *
175 * Compute U(J,J) and test for non-positive-definiteness.
176 *
177  ajj = real( real( a( j, j ) ) - cdotc( j-1, a( 1, j ), 1,
178  $ a( 1, j ), 1 ) )
179  IF( ajj.LE.zero.OR.sisnan( ajj ) ) THEN
180  a( j, j ) = ajj
181  GO TO 30
182  END IF
183  ajj = sqrt( ajj )
184  a( j, j ) = ajj
185 *
186 * Compute elements J+1:N of row J.
187 *
188  IF( j.LT.n ) THEN
189  CALL clacgv( j-1, a( 1, j ), 1 )
190  CALL cgemv( 'Transpose', j-1, n-j, -cone, a( 1, j+1 ),
191  $ lda, a( 1, j ), 1, cone, a( j, j+1 ), lda )
192  CALL clacgv( j-1, a( 1, j ), 1 )
193  CALL csscal( n-j, one / ajj, a( j, j+1 ), lda )
194  END IF
195  10 CONTINUE
196  ELSE
197 *
198 * Compute the Cholesky factorization A = L*L**H.
199 *
200  DO 20 j = 1, n
201 *
202 * Compute L(J,J) and test for non-positive-definiteness.
203 *
204  ajj = real( real( a( j, j ) ) - cdotc( j-1, a( j, 1 ), lda,
205  $ a( j, 1 ), lda ) )
206  IF( ajj.LE.zero.OR.sisnan( ajj ) ) THEN
207  a( j, j ) = ajj
208  GO TO 30
209  END IF
210  ajj = sqrt( ajj )
211  a( j, j ) = ajj
212 *
213 * Compute elements J+1:N of column J.
214 *
215  IF( j.LT.n ) THEN
216  CALL clacgv( j-1, a( j, 1 ), lda )
217  CALL cgemv( 'No transpose', n-j, j-1, -cone, a( j+1, 1 ),
218  $ lda, a( j, 1 ), lda, cone, a( j+1, j ), 1 )
219  CALL clacgv( j-1, a( j, 1 ), lda )
220  CALL csscal( n-j, one / ajj, a( j+1, j ), 1 )
221  END IF
222  20 CONTINUE
223  END IF
224  GO TO 40
225 *
226  30 CONTINUE
227  info = j
228 *
229  40 CONTINUE
230  RETURN
231 *
232 * End of CPOTF2
233 *
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:59
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
complex function cdotc(N, CX, INCX, CY, INCY)
CDOTC
Definition: cdotc.f:83
subroutine csscal(N, SA, CX, INCX)
CSSCAL
Definition: csscal.f:78
subroutine cgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CGEMV
Definition: cgemv.f:158
subroutine clacgv(N, X, INCX)
CLACGV conjugates a complex vector.
Definition: clacgv.f:74
Here is the call graph for this function:
Here is the caller graph for this function: