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