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