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