LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
cpotf2.f
Go to the documentation of this file.
00001 *> \brief \b CPOTF2
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CPOTF2 + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cpotf2.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cpotf2.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cpotf2.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE CPOTF2( UPLO, N, A, LDA, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          UPLO
00025 *       INTEGER            INFO, LDA, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       COMPLEX            A( LDA, * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> CPOTF2 computes the Cholesky factorization of a complex Hermitian
00038 *> positive definite matrix A.
00039 *>
00040 *> The factorization has the form
00041 *>    A = U**H * U ,  if UPLO = 'U', or
00042 *>    A = L  * L**H,  if UPLO = 'L',
00043 *> where U is an upper triangular matrix and L is lower triangular.
00044 *>
00045 *> This is the unblocked version of the algorithm, calling Level 2 BLAS.
00046 *> \endverbatim
00047 *
00048 *  Arguments:
00049 *  ==========
00050 *
00051 *> \param[in] UPLO
00052 *> \verbatim
00053 *>          UPLO is CHARACTER*1
00054 *>          Specifies whether the upper or lower triangular part of the
00055 *>          Hermitian matrix A is stored.
00056 *>          = 'U':  Upper triangular
00057 *>          = 'L':  Lower triangular
00058 *> \endverbatim
00059 *>
00060 *> \param[in] N
00061 *> \verbatim
00062 *>          N is INTEGER
00063 *>          The order of the matrix A.  N >= 0.
00064 *> \endverbatim
00065 *>
00066 *> \param[in,out] A
00067 *> \verbatim
00068 *>          A is COMPLEX array, dimension (LDA,N)
00069 *>          On entry, the Hermitian matrix A.  If UPLO = 'U', the leading
00070 *>          n by n upper triangular part of A contains the upper
00071 *>          triangular part of the matrix A, and the strictly lower
00072 *>          triangular part of A is not referenced.  If UPLO = 'L', the
00073 *>          leading n by n lower triangular part of A contains the lower
00074 *>          triangular part of the matrix A, and the strictly upper
00075 *>          triangular part of A is not referenced.
00076 *>
00077 *>          On exit, if INFO = 0, the factor U or L from the Cholesky
00078 *>          factorization A = U**H *U  or A = L*L**H.
00079 *> \endverbatim
00080 *>
00081 *> \param[in] LDA
00082 *> \verbatim
00083 *>          LDA is INTEGER
00084 *>          The leading dimension of the array A.  LDA >= max(1,N).
00085 *> \endverbatim
00086 *>
00087 *> \param[out] INFO
00088 *> \verbatim
00089 *>          INFO is INTEGER
00090 *>          = 0: successful exit
00091 *>          < 0: if INFO = -k, the k-th argument had an illegal value
00092 *>          > 0: if INFO = k, the leading minor of order k is not
00093 *>               positive definite, and the factorization could not be
00094 *>               completed.
00095 *> \endverbatim
00096 *
00097 *  Authors:
00098 *  ========
00099 *
00100 *> \author Univ. of Tennessee 
00101 *> \author Univ. of California Berkeley 
00102 *> \author Univ. of Colorado Denver 
00103 *> \author NAG Ltd. 
00104 *
00105 *> \date November 2011
00106 *
00107 *> \ingroup complexPOcomputational
00108 *
00109 *  =====================================================================
00110       SUBROUTINE CPOTF2( UPLO, N, A, LDA, INFO )
00111 *
00112 *  -- LAPACK computational routine (version 3.4.0) --
00113 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00114 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00115 *     November 2011
00116 *
00117 *     .. Scalar Arguments ..
00118       CHARACTER          UPLO
00119       INTEGER            INFO, LDA, N
00120 *     ..
00121 *     .. Array Arguments ..
00122       COMPLEX            A( LDA, * )
00123 *     ..
00124 *
00125 *  =====================================================================
00126 *
00127 *     .. Parameters ..
00128       REAL               ONE, ZERO
00129       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00130       COMPLEX            CONE
00131       PARAMETER          ( CONE = ( 1.0E+0, 0.0E+0 ) )
00132 *     ..
00133 *     .. Local Scalars ..
00134       LOGICAL            UPPER
00135       INTEGER            J
00136       REAL               AJJ
00137 *     ..
00138 *     .. External Functions ..
00139       LOGICAL            LSAME, SISNAN
00140       COMPLEX            CDOTC
00141       EXTERNAL           LSAME, CDOTC, SISNAN
00142 *     ..
00143 *     .. External Subroutines ..
00144       EXTERNAL           CGEMV, CLACGV, CSSCAL, XERBLA
00145 *     ..
00146 *     .. Intrinsic Functions ..
00147       INTRINSIC          MAX, REAL, SQRT
00148 *     ..
00149 *     .. Executable Statements ..
00150 *
00151 *     Test the input parameters.
00152 *
00153       INFO = 0
00154       UPPER = LSAME( UPLO, 'U' )
00155       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00156          INFO = -1
00157       ELSE IF( N.LT.0 ) THEN
00158          INFO = -2
00159       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00160          INFO = -4
00161       END IF
00162       IF( INFO.NE.0 ) THEN
00163          CALL XERBLA( 'CPOTF2', -INFO )
00164          RETURN
00165       END IF
00166 *
00167 *     Quick return if possible
00168 *
00169       IF( N.EQ.0 )
00170      $   RETURN
00171 *
00172       IF( UPPER ) THEN
00173 *
00174 *        Compute the Cholesky factorization A = U**H *U.
00175 *
00176          DO 10 J = 1, N
00177 *
00178 *           Compute U(J,J) and test for non-positive-definiteness.
00179 *
00180             AJJ = REAL( A( J, J ) ) - CDOTC( J-1, A( 1, J ), 1,
00181      $            A( 1, J ), 1 )
00182             IF( AJJ.LE.ZERO.OR.SISNAN( AJJ ) ) THEN
00183                A( J, J ) = AJJ
00184                GO TO 30
00185             END IF
00186             AJJ = SQRT( AJJ )
00187             A( J, J ) = AJJ
00188 *
00189 *           Compute elements J+1:N of row J.
00190 *
00191             IF( J.LT.N ) THEN
00192                CALL CLACGV( J-1, A( 1, J ), 1 )
00193                CALL CGEMV( 'Transpose', J-1, N-J, -CONE, A( 1, J+1 ),
00194      $                     LDA, A( 1, J ), 1, CONE, A( J, J+1 ), LDA )
00195                CALL CLACGV( J-1, A( 1, J ), 1 )
00196                CALL CSSCAL( N-J, ONE / AJJ, A( J, J+1 ), LDA )
00197             END IF
00198    10    CONTINUE
00199       ELSE
00200 *
00201 *        Compute the Cholesky factorization A = L*L**H.
00202 *
00203          DO 20 J = 1, N
00204 *
00205 *           Compute L(J,J) and test for non-positive-definiteness.
00206 *
00207             AJJ = REAL( A( J, J ) ) - CDOTC( J-1, A( J, 1 ), LDA,
00208      $            A( J, 1 ), LDA )
00209             IF( AJJ.LE.ZERO.OR.SISNAN( AJJ ) ) THEN
00210                A( J, J ) = AJJ
00211                GO TO 30
00212             END IF
00213             AJJ = SQRT( AJJ )
00214             A( J, J ) = AJJ
00215 *
00216 *           Compute elements J+1:N of column J.
00217 *
00218             IF( J.LT.N ) THEN
00219                CALL CLACGV( J-1, A( J, 1 ), LDA )
00220                CALL CGEMV( 'No transpose', N-J, J-1, -CONE, A( J+1, 1 ),
00221      $                     LDA, A( J, 1 ), LDA, CONE, A( J+1, J ), 1 )
00222                CALL CLACGV( J-1, A( J, 1 ), LDA )
00223                CALL CSSCAL( N-J, ONE / AJJ, A( J+1, J ), 1 )
00224             END IF
00225    20    CONTINUE
00226       END IF
00227       GO TO 40
00228 *
00229    30 CONTINUE
00230       INFO = J
00231 *
00232    40 CONTINUE
00233       RETURN
00234 *
00235 *     End of CPOTF2
00236 *
00237       END
 All Files Functions