LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dtrcon.f
Go to the documentation of this file.
00001 *> \brief \b DTRCON
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DTRCON + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dtrcon.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dtrcon.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dtrcon.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK,
00022 *                          IWORK, INFO )
00023 * 
00024 *       .. Scalar Arguments ..
00025 *       CHARACTER          DIAG, NORM, UPLO
00026 *       INTEGER            INFO, LDA, N
00027 *       DOUBLE PRECISION   RCOND
00028 *       ..
00029 *       .. Array Arguments ..
00030 *       INTEGER            IWORK( * )
00031 *       DOUBLE PRECISION   A( LDA, * ), WORK( * )
00032 *       ..
00033 *  
00034 *
00035 *> \par Purpose:
00036 *  =============
00037 *>
00038 *> \verbatim
00039 *>
00040 *> DTRCON estimates the reciprocal of the condition number of a
00041 *> triangular matrix A, in either the 1-norm or the infinity-norm.
00042 *>
00043 *> The norm of A is computed and an estimate is obtained for
00044 *> norm(inv(A)), then the reciprocal of the condition number is
00045 *> computed as
00046 *>    RCOND = 1 / ( norm(A) * norm(inv(A)) ).
00047 *> \endverbatim
00048 *
00049 *  Arguments:
00050 *  ==========
00051 *
00052 *> \param[in] NORM
00053 *> \verbatim
00054 *>          NORM is CHARACTER*1
00055 *>          Specifies whether the 1-norm condition number or the
00056 *>          infinity-norm condition number is required:
00057 *>          = '1' or 'O':  1-norm;
00058 *>          = 'I':         Infinity-norm.
00059 *> \endverbatim
00060 *>
00061 *> \param[in] UPLO
00062 *> \verbatim
00063 *>          UPLO is CHARACTER*1
00064 *>          = 'U':  A is upper triangular;
00065 *>          = 'L':  A is lower triangular.
00066 *> \endverbatim
00067 *>
00068 *> \param[in] DIAG
00069 *> \verbatim
00070 *>          DIAG is CHARACTER*1
00071 *>          = 'N':  A is non-unit triangular;
00072 *>          = 'U':  A is unit triangular.
00073 *> \endverbatim
00074 *>
00075 *> \param[in] N
00076 *> \verbatim
00077 *>          N is INTEGER
00078 *>          The order of the matrix A.  N >= 0.
00079 *> \endverbatim
00080 *>
00081 *> \param[in] A
00082 *> \verbatim
00083 *>          A is DOUBLE PRECISION array, dimension (LDA,N)
00084 *>          The triangular matrix A.  If UPLO = 'U', the leading N-by-N
00085 *>          upper triangular part of the array A contains the upper
00086 *>          triangular matrix, and the strictly lower triangular part of
00087 *>          A is not referenced.  If UPLO = 'L', the leading N-by-N lower
00088 *>          triangular part of the array A contains the lower triangular
00089 *>          matrix, and the strictly upper triangular part of A is not
00090 *>          referenced.  If DIAG = 'U', the diagonal elements of A are
00091 *>          also not referenced and are assumed to be 1.
00092 *> \endverbatim
00093 *>
00094 *> \param[in] LDA
00095 *> \verbatim
00096 *>          LDA is INTEGER
00097 *>          The leading dimension of the array A.  LDA >= max(1,N).
00098 *> \endverbatim
00099 *>
00100 *> \param[out] RCOND
00101 *> \verbatim
00102 *>          RCOND is DOUBLE PRECISION
00103 *>          The reciprocal of the condition number of the matrix A,
00104 *>          computed as RCOND = 1/(norm(A) * norm(inv(A))).
00105 *> \endverbatim
00106 *>
00107 *> \param[out] WORK
00108 *> \verbatim
00109 *>          WORK is DOUBLE PRECISION array, dimension (3*N)
00110 *> \endverbatim
00111 *>
00112 *> \param[out] IWORK
00113 *> \verbatim
00114 *>          IWORK is INTEGER array, dimension (N)
00115 *> \endverbatim
00116 *>
00117 *> \param[out] INFO
00118 *> \verbatim
00119 *>          INFO is INTEGER
00120 *>          = 0:  successful exit
00121 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00122 *> \endverbatim
00123 *
00124 *  Authors:
00125 *  ========
00126 *
00127 *> \author Univ. of Tennessee 
00128 *> \author Univ. of California Berkeley 
00129 *> \author Univ. of Colorado Denver 
00130 *> \author NAG Ltd. 
00131 *
00132 *> \date November 2011
00133 *
00134 *> \ingroup doubleOTHERcomputational
00135 *
00136 *  =====================================================================
00137       SUBROUTINE DTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK,
00138      $                   IWORK, INFO )
00139 *
00140 *  -- LAPACK computational routine (version 3.4.0) --
00141 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00142 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00143 *     November 2011
00144 *
00145 *     .. Scalar Arguments ..
00146       CHARACTER          DIAG, NORM, UPLO
00147       INTEGER            INFO, LDA, N
00148       DOUBLE PRECISION   RCOND
00149 *     ..
00150 *     .. Array Arguments ..
00151       INTEGER            IWORK( * )
00152       DOUBLE PRECISION   A( LDA, * ), WORK( * )
00153 *     ..
00154 *
00155 *  =====================================================================
00156 *
00157 *     .. Parameters ..
00158       DOUBLE PRECISION   ONE, ZERO
00159       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00160 *     ..
00161 *     .. Local Scalars ..
00162       LOGICAL            NOUNIT, ONENRM, UPPER
00163       CHARACTER          NORMIN
00164       INTEGER            IX, KASE, KASE1
00165       DOUBLE PRECISION   AINVNM, ANORM, SCALE, SMLNUM, XNORM
00166 *     ..
00167 *     .. Local Arrays ..
00168       INTEGER            ISAVE( 3 )
00169 *     ..
00170 *     .. External Functions ..
00171       LOGICAL            LSAME
00172       INTEGER            IDAMAX
00173       DOUBLE PRECISION   DLAMCH, DLANTR
00174       EXTERNAL           LSAME, IDAMAX, DLAMCH, DLANTR
00175 *     ..
00176 *     .. External Subroutines ..
00177       EXTERNAL           DLACN2, DLATRS, DRSCL, XERBLA
00178 *     ..
00179 *     .. Intrinsic Functions ..
00180       INTRINSIC          ABS, DBLE, MAX
00181 *     ..
00182 *     .. Executable Statements ..
00183 *
00184 *     Test the input parameters.
00185 *
00186       INFO = 0
00187       UPPER = LSAME( UPLO, 'U' )
00188       ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' )
00189       NOUNIT = LSAME( DIAG, 'N' )
00190 *
00191       IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN
00192          INFO = -1
00193       ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00194          INFO = -2
00195       ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
00196          INFO = -3
00197       ELSE IF( N.LT.0 ) THEN
00198          INFO = -4
00199       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00200          INFO = -6
00201       END IF
00202       IF( INFO.NE.0 ) THEN
00203          CALL XERBLA( 'DTRCON', -INFO )
00204          RETURN
00205       END IF
00206 *
00207 *     Quick return if possible
00208 *
00209       IF( N.EQ.0 ) THEN
00210          RCOND = ONE
00211          RETURN
00212       END IF
00213 *
00214       RCOND = ZERO
00215       SMLNUM = DLAMCH( 'Safe minimum' )*DBLE( MAX( 1, N ) )
00216 *
00217 *     Compute the norm of the triangular matrix A.
00218 *
00219       ANORM = DLANTR( NORM, UPLO, DIAG, N, N, A, LDA, WORK )
00220 *
00221 *     Continue only if ANORM > 0.
00222 *
00223       IF( ANORM.GT.ZERO ) THEN
00224 *
00225 *        Estimate the norm of the inverse of A.
00226 *
00227          AINVNM = ZERO
00228          NORMIN = 'N'
00229          IF( ONENRM ) THEN
00230             KASE1 = 1
00231          ELSE
00232             KASE1 = 2
00233          END IF
00234          KASE = 0
00235    10    CONTINUE
00236          CALL DLACN2( N, WORK( N+1 ), WORK, IWORK, AINVNM, KASE, ISAVE )
00237          IF( KASE.NE.0 ) THEN
00238             IF( KASE.EQ.KASE1 ) THEN
00239 *
00240 *              Multiply by inv(A).
00241 *
00242                CALL DLATRS( UPLO, 'No transpose', DIAG, NORMIN, N, A,
00243      $                      LDA, WORK, SCALE, WORK( 2*N+1 ), INFO )
00244             ELSE
00245 *
00246 *              Multiply by inv(A**T).
00247 *
00248                CALL DLATRS( UPLO, 'Transpose', DIAG, NORMIN, N, A, LDA,
00249      $                      WORK, SCALE, WORK( 2*N+1 ), INFO )
00250             END IF
00251             NORMIN = 'Y'
00252 *
00253 *           Multiply by 1/SCALE if doing so will not cause overflow.
00254 *
00255             IF( SCALE.NE.ONE ) THEN
00256                IX = IDAMAX( N, WORK, 1 )
00257                XNORM = ABS( WORK( IX ) )
00258                IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO )
00259      $            GO TO 20
00260                CALL DRSCL( N, SCALE, WORK, 1 )
00261             END IF
00262             GO TO 10
00263          END IF
00264 *
00265 *        Compute the estimate of the reciprocal condition number.
00266 *
00267          IF( AINVNM.NE.ZERO )
00268      $      RCOND = ( ONE / ANORM ) / AINVNM
00269       END IF
00270 *
00271    20 CONTINUE
00272       RETURN
00273 *
00274 *     End of DTRCON
00275 *
00276       END
 All Files Functions