LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cpptrf ( character  UPLO,
integer  N,
complex, dimension( * )  AP,
integer  INFO 
)

CPPTRF

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

Purpose:
 CPPTRF computes the Cholesky factorization of a complex Hermitian
 positive definite matrix A stored in packed format.

 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.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored;
          = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]AP
          AP is COMPLEX array, dimension (N*(N+1)/2)
          On entry, the upper or lower triangle of the Hermitian matrix
          A, packed columnwise in a linear array.  The j-th column of A
          is stored in the array AP as follows:
          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
          See below for further details.

          On exit, if INFO = 0, the triangular factor U or L from the
          Cholesky factorization A = U**H*U or A = L*L**H, in the same
          storage format as A.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i, the leading minor of order i 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.
Date
November 2011
Further Details:
  The packed storage scheme is illustrated by the following example
  when N = 4, UPLO = 'U':

  Two-dimensional storage of the Hermitian matrix A:

     a11 a12 a13 a14
         a22 a23 a24
             a33 a34     (aij = conjg(aji))
                 a44

  Packed storage of the upper triangle of A:

  AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]

Definition at line 121 of file cpptrf.f.

121 *
122 * -- LAPACK computational routine (version 3.4.0) --
123 * -- LAPACK is a software package provided by Univ. of Tennessee, --
124 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125 * November 2011
126 *
127 * .. Scalar Arguments ..
128  CHARACTER uplo
129  INTEGER info, n
130 * ..
131 * .. Array Arguments ..
132  COMPLEX ap( * )
133 * ..
134 *
135 * =====================================================================
136 *
137 * .. Parameters ..
138  REAL zero, one
139  parameter ( zero = 0.0e+0, one = 1.0e+0 )
140 * ..
141 * .. Local Scalars ..
142  LOGICAL upper
143  INTEGER j, jc, jj
144  REAL ajj
145 * ..
146 * .. External Functions ..
147  LOGICAL lsame
148  COMPLEX cdotc
149  EXTERNAL lsame, cdotc
150 * ..
151 * .. External Subroutines ..
152  EXTERNAL chpr, csscal, ctpsv, xerbla
153 * ..
154 * .. Intrinsic Functions ..
155  INTRINSIC REAL, sqrt
156 * ..
157 * .. Executable Statements ..
158 *
159 * Test the input parameters.
160 *
161  info = 0
162  upper = lsame( uplo, 'U' )
163  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
164  info = -1
165  ELSE IF( n.LT.0 ) THEN
166  info = -2
167  END IF
168  IF( info.NE.0 ) THEN
169  CALL xerbla( 'CPPTRF', -info )
170  RETURN
171  END IF
172 *
173 * Quick return if possible
174 *
175  IF( n.EQ.0 )
176  $ RETURN
177 *
178  IF( upper ) THEN
179 *
180 * Compute the Cholesky factorization A = U**H * U.
181 *
182  jj = 0
183  DO 10 j = 1, n
184  jc = jj + 1
185  jj = jj + j
186 *
187 * Compute elements 1:J-1 of column J.
188 *
189  IF( j.GT.1 )
190  $ CALL ctpsv( 'Upper', 'Conjugate transpose', 'Non-unit',
191  $ j-1, ap, ap( jc ), 1 )
192 *
193 * Compute U(J,J) and test for non-positive-definiteness.
194 *
195  ajj = REAL( AP( JJ ) ) - cdotc( j-1, ap( jc ), 1, ap( jc ),
196  $ 1 )
197  IF( ajj.LE.zero ) THEN
198  ap( jj ) = ajj
199  GO TO 30
200  END IF
201  ap( jj ) = sqrt( ajj )
202  10 CONTINUE
203  ELSE
204 *
205 * Compute the Cholesky factorization A = L * L**H.
206 *
207  jj = 1
208  DO 20 j = 1, n
209 *
210 * Compute L(J,J) and test for non-positive-definiteness.
211 *
212  ajj = REAL( AP( JJ ) )
213  IF( ajj.LE.zero ) THEN
214  ap( jj ) = ajj
215  GO TO 30
216  END IF
217  ajj = sqrt( ajj )
218  ap( jj ) = ajj
219 *
220 * Compute elements J+1:N of column J and update the trailing
221 * submatrix.
222 *
223  IF( j.LT.n ) THEN
224  CALL csscal( n-j, one / ajj, ap( jj+1 ), 1 )
225  CALL chpr( 'Lower', n-j, -one, ap( jj+1 ), 1,
226  $ ap( jj+n-j+1 ) )
227  jj = jj + n - j + 1
228  END IF
229  20 CONTINUE
230  END IF
231  GO TO 40
232 *
233  30 CONTINUE
234  info = j
235 *
236  40 CONTINUE
237  RETURN
238 *
239 * End of CPPTRF
240 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine chpr(UPLO, N, ALPHA, X, INCX, AP)
CHPR
Definition: chpr.f:132
complex function cdotc(N, CX, INCX, CY, INCY)
CDOTC
Definition: cdotc.f:54
subroutine ctpsv(UPLO, TRANS, DIAG, N, AP, X, INCX)
CTPSV
Definition: ctpsv.f:146
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine csscal(N, SA, CX, INCX)
CSSCAL
Definition: csscal.f:54

Here is the call graph for this function:

Here is the caller graph for this function: