LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
ctpcon.f
Go to the documentation of this file.
00001 *> \brief \b CTPCON
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CTPCON + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctpcon.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctpcon.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctpcon.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE CTPCON( NORM, UPLO, DIAG, N, AP, RCOND, WORK, RWORK,
00022 *                          INFO )
00023 * 
00024 *       .. Scalar Arguments ..
00025 *       CHARACTER          DIAG, NORM, UPLO
00026 *       INTEGER            INFO, N
00027 *       REAL               RCOND
00028 *       ..
00029 *       .. Array Arguments ..
00030 *       REAL               RWORK( * )
00031 *       COMPLEX            AP( * ), WORK( * )
00032 *       ..
00033 *  
00034 *
00035 *> \par Purpose:
00036 *  =============
00037 *>
00038 *> \verbatim
00039 *>
00040 *> CTPCON estimates the reciprocal of the condition number of a packed
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] AP
00082 *> \verbatim
00083 *>          AP is COMPLEX array, dimension (N*(N+1)/2)
00084 *>          The upper or lower triangular matrix A, packed columnwise in
00085 *>          a linear array.  The j-th column of A is stored in the array
00086 *>          AP as follows:
00087 *>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
00088 *>          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
00089 *>          If DIAG = 'U', the diagonal elements of A are not referenced
00090 *>          and are assumed to be 1.
00091 *> \endverbatim
00092 *>
00093 *> \param[out] RCOND
00094 *> \verbatim
00095 *>          RCOND is REAL
00096 *>          The reciprocal of the condition number of the matrix A,
00097 *>          computed as RCOND = 1/(norm(A) * norm(inv(A))).
00098 *> \endverbatim
00099 *>
00100 *> \param[out] WORK
00101 *> \verbatim
00102 *>          WORK is COMPLEX array, dimension (2*N)
00103 *> \endverbatim
00104 *>
00105 *> \param[out] RWORK
00106 *> \verbatim
00107 *>          RWORK is REAL array, dimension (N)
00108 *> \endverbatim
00109 *>
00110 *> \param[out] INFO
00111 *> \verbatim
00112 *>          INFO is INTEGER
00113 *>          = 0:  successful exit
00114 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00115 *> \endverbatim
00116 *
00117 *  Authors:
00118 *  ========
00119 *
00120 *> \author Univ. of Tennessee 
00121 *> \author Univ. of California Berkeley 
00122 *> \author Univ. of Colorado Denver 
00123 *> \author NAG Ltd. 
00124 *
00125 *> \date November 2011
00126 *
00127 *> \ingroup complexOTHERcomputational
00128 *
00129 *  =====================================================================
00130       SUBROUTINE CTPCON( NORM, UPLO, DIAG, N, AP, RCOND, WORK, RWORK,
00131      $                   INFO )
00132 *
00133 *  -- LAPACK computational routine (version 3.4.0) --
00134 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00135 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00136 *     November 2011
00137 *
00138 *     .. Scalar Arguments ..
00139       CHARACTER          DIAG, NORM, UPLO
00140       INTEGER            INFO, N
00141       REAL               RCOND
00142 *     ..
00143 *     .. Array Arguments ..
00144       REAL               RWORK( * )
00145       COMPLEX            AP( * ), WORK( * )
00146 *     ..
00147 *
00148 *  =====================================================================
00149 *
00150 *     .. Parameters ..
00151       REAL               ONE, ZERO
00152       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00153 *     ..
00154 *     .. Local Scalars ..
00155       LOGICAL            NOUNIT, ONENRM, UPPER
00156       CHARACTER          NORMIN
00157       INTEGER            IX, KASE, KASE1
00158       REAL               AINVNM, ANORM, SCALE, SMLNUM, XNORM
00159       COMPLEX            ZDUM
00160 *     ..
00161 *     .. Local Arrays ..
00162       INTEGER            ISAVE( 3 )
00163 *     ..
00164 *     .. External Functions ..
00165       LOGICAL            LSAME
00166       INTEGER            ICAMAX
00167       REAL               CLANTP, SLAMCH
00168       EXTERNAL           LSAME, ICAMAX, CLANTP, SLAMCH
00169 *     ..
00170 *     .. External Subroutines ..
00171       EXTERNAL           CLACN2, CLATPS, CSRSCL, XERBLA
00172 *     ..
00173 *     .. Intrinsic Functions ..
00174       INTRINSIC          ABS, AIMAG, MAX, REAL
00175 *     ..
00176 *     .. Statement Functions ..
00177       REAL               CABS1
00178 *     ..
00179 *     .. Statement Function definitions ..
00180       CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )
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       END IF
00200       IF( INFO.NE.0 ) THEN
00201          CALL XERBLA( 'CTPCON', -INFO )
00202          RETURN
00203       END IF
00204 *
00205 *     Quick return if possible
00206 *
00207       IF( N.EQ.0 ) THEN
00208          RCOND = ONE
00209          RETURN
00210       END IF
00211 *
00212       RCOND = ZERO
00213       SMLNUM = SLAMCH( 'Safe minimum' )*REAL( MAX( 1, N ) )
00214 *
00215 *     Compute the norm of the triangular matrix A.
00216 *
00217       ANORM = CLANTP( NORM, UPLO, DIAG, N, AP, RWORK )
00218 *
00219 *     Continue only if ANORM > 0.
00220 *
00221       IF( ANORM.GT.ZERO ) THEN
00222 *
00223 *        Estimate the norm of the inverse of A.
00224 *
00225          AINVNM = ZERO
00226          NORMIN = 'N'
00227          IF( ONENRM ) THEN
00228             KASE1 = 1
00229          ELSE
00230             KASE1 = 2
00231          END IF
00232          KASE = 0
00233    10    CONTINUE
00234          CALL CLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
00235          IF( KASE.NE.0 ) THEN
00236             IF( KASE.EQ.KASE1 ) THEN
00237 *
00238 *              Multiply by inv(A).
00239 *
00240                CALL CLATPS( UPLO, 'No transpose', DIAG, NORMIN, N, AP,
00241      $                      WORK, SCALE, RWORK, INFO )
00242             ELSE
00243 *
00244 *              Multiply by inv(A**H).
00245 *
00246                CALL CLATPS( UPLO, 'Conjugate transpose', DIAG, NORMIN,
00247      $                      N, AP, WORK, SCALE, RWORK, INFO )
00248             END IF
00249             NORMIN = 'Y'
00250 *
00251 *           Multiply by 1/SCALE if doing so will not cause overflow.
00252 *
00253             IF( SCALE.NE.ONE ) THEN
00254                IX = ICAMAX( N, WORK, 1 )
00255                XNORM = CABS1( WORK( IX ) )
00256                IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO )
00257      $            GO TO 20
00258                CALL CSRSCL( N, SCALE, WORK, 1 )
00259             END IF
00260             GO TO 10
00261          END IF
00262 *
00263 *        Compute the estimate of the reciprocal condition number.
00264 *
00265          IF( AINVNM.NE.ZERO )
00266      $      RCOND = ( ONE / ANORM ) / AINVNM
00267       END IF
00268 *
00269    20 CONTINUE
00270       RETURN
00271 *
00272 *     End of CTPCON
00273 *
00274       END
 All Files Functions