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