![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b DPOTF2 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download DPOTF2 + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dpotf2.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dpotf2.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dpotf2.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE DPOTF2( UPLO, N, A, LDA, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * CHARACTER UPLO 00025 * INTEGER INFO, LDA, N 00026 * .. 00027 * .. Array Arguments .. 00028 * DOUBLE PRECISION A( LDA, * ) 00029 * .. 00030 * 00031 * 00032 *> \par Purpose: 00033 * ============= 00034 *> 00035 *> \verbatim 00036 *> 00037 *> DPOTF2 computes the Cholesky factorization of a real symmetric 00038 *> positive definite matrix A. 00039 *> 00040 *> The factorization has the form 00041 *> A = U**T * U , if UPLO = 'U', or 00042 *> A = L * L**T, 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 *> symmetric 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 DOUBLE PRECISION array, dimension (LDA,N) 00069 *> On entry, the symmetric 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**T *U or A = L*L**T. 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 doublePOcomputational 00108 * 00109 * ===================================================================== 00110 SUBROUTINE DPOTF2( 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 DOUBLE PRECISION A( LDA, * ) 00123 * .. 00124 * 00125 * ===================================================================== 00126 * 00127 * .. Parameters .. 00128 DOUBLE PRECISION ONE, ZERO 00129 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) 00130 * .. 00131 * .. Local Scalars .. 00132 LOGICAL UPPER 00133 INTEGER J 00134 DOUBLE PRECISION AJJ 00135 * .. 00136 * .. External Functions .. 00137 LOGICAL LSAME, DISNAN 00138 DOUBLE PRECISION DDOT 00139 EXTERNAL LSAME, DDOT, DISNAN 00140 * .. 00141 * .. External Subroutines .. 00142 EXTERNAL DGEMV, DSCAL, XERBLA 00143 * .. 00144 * .. Intrinsic Functions .. 00145 INTRINSIC MAX, SQRT 00146 * .. 00147 * .. Executable Statements .. 00148 * 00149 * Test the input parameters. 00150 * 00151 INFO = 0 00152 UPPER = LSAME( UPLO, 'U' ) 00153 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN 00154 INFO = -1 00155 ELSE IF( N.LT.0 ) THEN 00156 INFO = -2 00157 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00158 INFO = -4 00159 END IF 00160 IF( INFO.NE.0 ) THEN 00161 CALL XERBLA( 'DPOTF2', -INFO ) 00162 RETURN 00163 END IF 00164 * 00165 * Quick return if possible 00166 * 00167 IF( N.EQ.0 ) 00168 $ RETURN 00169 * 00170 IF( UPPER ) THEN 00171 * 00172 * Compute the Cholesky factorization A = U**T *U. 00173 * 00174 DO 10 J = 1, N 00175 * 00176 * Compute U(J,J) and test for non-positive-definiteness. 00177 * 00178 AJJ = A( J, J ) - DDOT( J-1, A( 1, J ), 1, A( 1, J ), 1 ) 00179 IF( AJJ.LE.ZERO.OR.DISNAN( AJJ ) ) THEN 00180 A( J, J ) = AJJ 00181 GO TO 30 00182 END IF 00183 AJJ = SQRT( AJJ ) 00184 A( J, J ) = AJJ 00185 * 00186 * Compute elements J+1:N of row J. 00187 * 00188 IF( J.LT.N ) THEN 00189 CALL DGEMV( 'Transpose', J-1, N-J, -ONE, A( 1, J+1 ), 00190 $ LDA, A( 1, J ), 1, ONE, A( J, J+1 ), LDA ) 00191 CALL DSCAL( N-J, ONE / AJJ, A( J, J+1 ), LDA ) 00192 END IF 00193 10 CONTINUE 00194 ELSE 00195 * 00196 * Compute the Cholesky factorization A = L*L**T. 00197 * 00198 DO 20 J = 1, N 00199 * 00200 * Compute L(J,J) and test for non-positive-definiteness. 00201 * 00202 AJJ = A( J, J ) - DDOT( J-1, A( J, 1 ), LDA, A( J, 1 ), 00203 $ LDA ) 00204 IF( AJJ.LE.ZERO.OR.DISNAN( AJJ ) ) THEN 00205 A( J, J ) = AJJ 00206 GO TO 30 00207 END IF 00208 AJJ = SQRT( AJJ ) 00209 A( J, J ) = AJJ 00210 * 00211 * Compute elements J+1:N of column J. 00212 * 00213 IF( J.LT.N ) THEN 00214 CALL DGEMV( 'No transpose', N-J, J-1, -ONE, A( J+1, 1 ), 00215 $ LDA, A( J, 1 ), LDA, ONE, A( J+1, J ), 1 ) 00216 CALL DSCAL( N-J, ONE / AJJ, A( J+1, J ), 1 ) 00217 END IF 00218 20 CONTINUE 00219 END IF 00220 GO TO 40 00221 * 00222 30 CONTINUE 00223 INFO = J 00224 * 00225 40 CONTINUE 00226 RETURN 00227 * 00228 * End of DPOTF2 00229 * 00230 END