LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
cla_gercond_c.f
Go to the documentation of this file.
00001 *> \brief \b CLA_GERCOND_C
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CLA_GERCOND_C + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_gercond_c.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_gercond_c.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_gercond_c.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       REAL FUNCTION CLA_GERCOND_C( TRANS, N, A, LDA, AF, LDAF, IPIV, C,
00022 *                                    CAPPLY, INFO, WORK, RWORK )
00023 * 
00024 *       .. Scalar Aguments ..
00025 *       CHARACTER          TRANS
00026 *       LOGICAL            CAPPLY
00027 *       INTEGER            N, LDA, LDAF, INFO
00028 *       ..
00029 *       .. Array Arguments ..
00030 *       INTEGER            IPIV( * )
00031 *       COMPLEX            A( LDA, * ), AF( LDAF, * ), WORK( * )
00032 *       REAL               C( * ), RWORK( * )
00033 *       ..
00034 *  
00035 *
00036 *> \par Purpose:
00037 *  =============
00038 *>
00039 *> \verbatim
00040 *>
00041 *> 
00042 *>    CLA_GERCOND_C computes the infinity norm condition number of
00043 *>    op(A) * inv(diag(C)) where C is a REAL vector.
00044 *> \endverbatim
00045 *
00046 *  Arguments:
00047 *  ==========
00048 *
00049 *> \param[in] TRANS
00050 *> \verbatim
00051 *>          TRANS is CHARACTER*1
00052 *>     Specifies the form of the system of equations:
00053 *>       = 'N':  A * X = B     (No transpose)
00054 *>       = 'T':  A**T * X = B  (Transpose)
00055 *>       = 'C':  A**H * X = B  (Conjugate Transpose = Transpose)
00056 *> \endverbatim
00057 *>
00058 *> \param[in] N
00059 *> \verbatim
00060 *>          N is INTEGER
00061 *>     The number of linear equations, i.e., the order of the
00062 *>     matrix A.  N >= 0.
00063 *> \endverbatim
00064 *>
00065 *> \param[in] A
00066 *> \verbatim
00067 *>          A is COMPLEX array, dimension (LDA,N)
00068 *>     On entry, the N-by-N matrix A
00069 *> \endverbatim
00070 *>
00071 *> \param[in] LDA
00072 *> \verbatim
00073 *>          LDA is INTEGER
00074 *>     The leading dimension of the array A.  LDA >= max(1,N).
00075 *> \endverbatim
00076 *>
00077 *> \param[in] AF
00078 *> \verbatim
00079 *>          AF is COMPLEX array, dimension (LDAF,N)
00080 *>     The factors L and U from the factorization
00081 *>     A = P*L*U as computed by CGETRF.
00082 *> \endverbatim
00083 *>
00084 *> \param[in] LDAF
00085 *> \verbatim
00086 *>          LDAF is INTEGER
00087 *>     The leading dimension of the array AF.  LDAF >= max(1,N).
00088 *> \endverbatim
00089 *>
00090 *> \param[in] IPIV
00091 *> \verbatim
00092 *>          IPIV is INTEGER array, dimension (N)
00093 *>     The pivot indices from the factorization A = P*L*U
00094 *>     as computed by CGETRF; row i of the matrix was interchanged
00095 *>     with row IPIV(i).
00096 *> \endverbatim
00097 *>
00098 *> \param[in] C
00099 *> \verbatim
00100 *>          C is REAL array, dimension (N)
00101 *>     The vector C in the formula op(A) * inv(diag(C)).
00102 *> \endverbatim
00103 *>
00104 *> \param[in] CAPPLY
00105 *> \verbatim
00106 *>          CAPPLY is LOGICAL
00107 *>     If .TRUE. then access the vector C in the formula above.
00108 *> \endverbatim
00109 *>
00110 *> \param[out] INFO
00111 *> \verbatim
00112 *>          INFO is INTEGER
00113 *>       = 0:  Successful exit.
00114 *>     i > 0:  The ith argument is invalid.
00115 *> \endverbatim
00116 *>
00117 *> \param[in] WORK
00118 *> \verbatim
00119 *>          WORK is COMPLEX array, dimension (2*N).
00120 *>     Workspace.
00121 *> \endverbatim
00122 *>
00123 *> \param[in] RWORK
00124 *> \verbatim
00125 *>          RWORK is REAL array, dimension (N).
00126 *>     Workspace.
00127 *> \endverbatim
00128 *
00129 *  Authors:
00130 *  ========
00131 *
00132 *> \author Univ. of Tennessee 
00133 *> \author Univ. of California Berkeley 
00134 *> \author Univ. of Colorado Denver 
00135 *> \author NAG Ltd. 
00136 *
00137 *> \date November 2011
00138 *
00139 *> \ingroup complexGEcomputational
00140 *
00141 *  =====================================================================
00142       REAL FUNCTION CLA_GERCOND_C( TRANS, N, A, LDA, AF, LDAF, IPIV, C,
00143      $                             CAPPLY, INFO, WORK, RWORK )
00144 *
00145 *  -- LAPACK computational routine (version 3.4.0) --
00146 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00147 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00148 *     November 2011
00149 *
00150 *     .. Scalar Aguments ..
00151       CHARACTER          TRANS
00152       LOGICAL            CAPPLY
00153       INTEGER            N, LDA, LDAF, INFO
00154 *     ..
00155 *     .. Array Arguments ..
00156       INTEGER            IPIV( * )
00157       COMPLEX            A( LDA, * ), AF( LDAF, * ), WORK( * )
00158       REAL               C( * ), RWORK( * )
00159 *     ..
00160 *
00161 *  =====================================================================
00162 *
00163 *     .. Local Scalars ..
00164       LOGICAL            NOTRANS
00165       INTEGER            KASE, I, J
00166       REAL               AINVNM, ANORM, TMP
00167       COMPLEX            ZDUM
00168 *     ..
00169 *     .. Local Arrays ..
00170       INTEGER            ISAVE( 3 )
00171 *     ..
00172 *     .. External Functions ..
00173       LOGICAL            LSAME
00174       EXTERNAL           LSAME
00175 *     ..
00176 *     .. External Subroutines ..
00177       EXTERNAL           CLACN2, CGETRS, XERBLA
00178 *     ..
00179 *     .. Intrinsic Functions ..
00180       INTRINSIC          ABS, MAX, REAL, AIMAG
00181 *     ..
00182 *     .. Statement Functions ..
00183       REAL               CABS1
00184 *     ..
00185 *     .. Statement Function Definitions ..
00186       CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )
00187 *     ..
00188 *     .. Executable Statements ..
00189       CLA_GERCOND_C = 0.0E+0
00190 *
00191       INFO = 0
00192       NOTRANS = LSAME( TRANS, 'N' )
00193       IF ( .NOT. NOTRANS .AND. .NOT. LSAME( TRANS, 'T' ) .AND. .NOT.
00194      $     LSAME( TRANS, 'C' ) ) THEN
00195          INFO = -1
00196       ELSE IF( N.LT.0 ) THEN
00197          INFO = -2
00198       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00199          INFO = -4
00200       ELSE IF( LDAF.LT.MAX( 1, N ) ) THEN
00201          INFO = -6
00202       END IF
00203       IF( INFO.NE.0 ) THEN
00204          CALL XERBLA( 'CLA_GERCOND_C', -INFO )
00205          RETURN
00206       END IF
00207 *
00208 *     Compute norm of op(A)*op2(C).
00209 *
00210       ANORM = 0.0E+0
00211       IF ( NOTRANS ) THEN
00212          DO I = 1, N
00213             TMP = 0.0E+0
00214             IF ( CAPPLY ) THEN
00215                DO J = 1, N
00216                   TMP = TMP + CABS1( A( I, J ) ) / C( J )
00217                END DO
00218             ELSE
00219                DO J = 1, N
00220                   TMP = TMP + CABS1( A( I, J ) )
00221                END DO
00222             END IF
00223             RWORK( I ) = TMP
00224             ANORM = MAX( ANORM, TMP )
00225          END DO
00226       ELSE
00227          DO I = 1, N
00228             TMP = 0.0E+0
00229             IF ( CAPPLY ) THEN
00230                DO J = 1, N
00231                   TMP = TMP + CABS1( A( J, I ) ) / C( J )
00232                END DO
00233             ELSE
00234                DO J = 1, N
00235                   TMP = TMP + CABS1( A( J, I ) )
00236                END DO
00237             END IF
00238             RWORK( I ) = TMP
00239             ANORM = MAX( ANORM, TMP )
00240          END DO
00241       END IF
00242 *
00243 *     Quick return if possible.
00244 *
00245       IF( N.EQ.0 ) THEN
00246          CLA_GERCOND_C = 1.0E+0
00247          RETURN
00248       ELSE IF( ANORM .EQ. 0.0E+0 ) THEN
00249          RETURN
00250       END IF
00251 *
00252 *     Estimate the norm of inv(op(A)).
00253 *
00254       AINVNM = 0.0E+0
00255 *
00256       KASE = 0
00257    10 CONTINUE
00258       CALL CLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
00259       IF( KASE.NE.0 ) THEN
00260          IF( KASE.EQ.2 ) THEN
00261 *
00262 *           Multiply by R.
00263 *
00264             DO I = 1, N
00265                WORK( I ) = WORK( I ) * RWORK( I )
00266             END DO
00267 *
00268             IF (NOTRANS) THEN
00269                CALL CGETRS( 'No transpose', N, 1, AF, LDAF, IPIV,
00270      $            WORK, N, INFO )
00271             ELSE
00272                CALL CGETRS( 'Conjugate transpose', N, 1, AF, LDAF, IPIV,
00273      $            WORK, N, INFO )
00274             ENDIF
00275 *
00276 *           Multiply by inv(C).
00277 *
00278             IF ( CAPPLY ) THEN
00279                DO I = 1, N
00280                   WORK( I ) = WORK( I ) * C( I )
00281                END DO
00282             END IF
00283          ELSE
00284 *
00285 *           Multiply by inv(C**H).
00286 *
00287             IF ( CAPPLY ) THEN
00288                DO I = 1, N
00289                   WORK( I ) = WORK( I ) * C( I )
00290                END DO
00291             END IF
00292 *
00293             IF ( NOTRANS ) THEN
00294                CALL CGETRS( 'Conjugate transpose', N, 1, AF, LDAF, IPIV,
00295      $            WORK, N, INFO )
00296             ELSE
00297                CALL CGETRS( 'No transpose', N, 1, AF, LDAF, IPIV,
00298      $            WORK, N, INFO )
00299             END IF
00300 *
00301 *           Multiply by R.
00302 *
00303             DO I = 1, N
00304                WORK( I ) = WORK( I ) * RWORK( I )
00305             END DO
00306          END IF
00307          GO TO 10
00308       END IF
00309 *
00310 *     Compute the estimate of the reciprocal condition number.
00311 *
00312       IF( AINVNM .NE. 0.0E+0 )
00313      $   CLA_GERCOND_C = 1.0E+0 / AINVNM
00314 *
00315       RETURN
00316 *
00317       END
 All Files Functions