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