LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
slaqge.f
Go to the documentation of this file.
00001 *> \brief \b SLAQGE
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download SLAQGE + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaqge.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaqge.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaqge.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE SLAQGE( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
00022 *                          EQUED )
00023 * 
00024 *       .. Scalar Arguments ..
00025 *       CHARACTER          EQUED
00026 *       INTEGER            LDA, M, N
00027 *       REAL               AMAX, COLCND, ROWCND
00028 *       ..
00029 *       .. Array Arguments ..
00030 *       REAL               A( LDA, * ), C( * ), R( * )
00031 *       ..
00032 *  
00033 *
00034 *> \par Purpose:
00035 *  =============
00036 *>
00037 *> \verbatim
00038 *>
00039 *> SLAQGE equilibrates a general M by N matrix A using the row and
00040 *> column scaling factors in the vectors R and C.
00041 *> \endverbatim
00042 *
00043 *  Arguments:
00044 *  ==========
00045 *
00046 *> \param[in] M
00047 *> \verbatim
00048 *>          M is INTEGER
00049 *>          The number of rows of the matrix A.  M >= 0.
00050 *> \endverbatim
00051 *>
00052 *> \param[in] N
00053 *> \verbatim
00054 *>          N is INTEGER
00055 *>          The number of columns of the matrix A.  N >= 0.
00056 *> \endverbatim
00057 *>
00058 *> \param[in,out] A
00059 *> \verbatim
00060 *>          A is REAL array, dimension (LDA,N)
00061 *>          On entry, the M by N matrix A.
00062 *>          On exit, the equilibrated matrix.  See EQUED for the form of
00063 *>          the equilibrated matrix.
00064 *> \endverbatim
00065 *>
00066 *> \param[in] LDA
00067 *> \verbatim
00068 *>          LDA is INTEGER
00069 *>          The leading dimension of the array A.  LDA >= max(M,1).
00070 *> \endverbatim
00071 *>
00072 *> \param[in] R
00073 *> \verbatim
00074 *>          R is REAL array, dimension (M)
00075 *>          The row scale factors for A.
00076 *> \endverbatim
00077 *>
00078 *> \param[in] C
00079 *> \verbatim
00080 *>          C is REAL array, dimension (N)
00081 *>          The column scale factors for A.
00082 *> \endverbatim
00083 *>
00084 *> \param[in] ROWCND
00085 *> \verbatim
00086 *>          ROWCND is REAL
00087 *>          Ratio of the smallest R(i) to the largest R(i).
00088 *> \endverbatim
00089 *>
00090 *> \param[in] COLCND
00091 *> \verbatim
00092 *>          COLCND is REAL
00093 *>          Ratio of the smallest C(i) to the largest C(i).
00094 *> \endverbatim
00095 *>
00096 *> \param[in] AMAX
00097 *> \verbatim
00098 *>          AMAX is REAL
00099 *>          Absolute value of largest matrix entry.
00100 *> \endverbatim
00101 *>
00102 *> \param[out] EQUED
00103 *> \verbatim
00104 *>          EQUED is CHARACTER*1
00105 *>          Specifies the form of equilibration that was done.
00106 *>          = 'N':  No equilibration
00107 *>          = 'R':  Row equilibration, i.e., A has been premultiplied by
00108 *>                  diag(R).
00109 *>          = 'C':  Column equilibration, i.e., A has been postmultiplied
00110 *>                  by diag(C).
00111 *>          = 'B':  Both row and column equilibration, i.e., A has been
00112 *>                  replaced by diag(R) * A * diag(C).
00113 *> \endverbatim
00114 *
00115 *> \par Internal Parameters:
00116 *  =========================
00117 *>
00118 *> \verbatim
00119 *>  THRESH is a threshold value used to decide if row or column scaling
00120 *>  should be done based on the ratio of the row or column scaling
00121 *>  factors.  If ROWCND < THRESH, row scaling is done, and if
00122 *>  COLCND < THRESH, column scaling is done.
00123 *>
00124 *>  LARGE and SMALL are threshold values used to decide if row scaling
00125 *>  should be done based on the absolute size of the largest matrix
00126 *>  element.  If AMAX > LARGE or AMAX < SMALL, row scaling is done.
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 realGEauxiliary
00140 *
00141 *  =====================================================================
00142       SUBROUTINE SLAQGE( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
00143      $                   EQUED )
00144 *
00145 *  -- LAPACK auxiliary 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 Arguments ..
00151       CHARACTER          EQUED
00152       INTEGER            LDA, M, N
00153       REAL               AMAX, COLCND, ROWCND
00154 *     ..
00155 *     .. Array Arguments ..
00156       REAL               A( LDA, * ), C( * ), R( * )
00157 *     ..
00158 *
00159 *  =====================================================================
00160 *
00161 *     .. Parameters ..
00162       REAL               ONE, THRESH
00163       PARAMETER          ( ONE = 1.0E+0, THRESH = 0.1E+0 )
00164 *     ..
00165 *     .. Local Scalars ..
00166       INTEGER            I, J
00167       REAL               CJ, LARGE, SMALL
00168 *     ..
00169 *     .. External Functions ..
00170       REAL               SLAMCH
00171       EXTERNAL           SLAMCH
00172 *     ..
00173 *     .. Executable Statements ..
00174 *
00175 *     Quick return if possible
00176 *
00177       IF( M.LE.0 .OR. N.LE.0 ) THEN
00178          EQUED = 'N'
00179          RETURN
00180       END IF
00181 *
00182 *     Initialize LARGE and SMALL.
00183 *
00184       SMALL = SLAMCH( 'Safe minimum' ) / SLAMCH( 'Precision' )
00185       LARGE = ONE / SMALL
00186 *
00187       IF( ROWCND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE )
00188      $     THEN
00189 *
00190 *        No row scaling
00191 *
00192          IF( COLCND.GE.THRESH ) THEN
00193 *
00194 *           No column scaling
00195 *
00196             EQUED = 'N'
00197          ELSE
00198 *
00199 *           Column scaling
00200 *
00201             DO 20 J = 1, N
00202                CJ = C( J )
00203                DO 10 I = 1, M
00204                   A( I, J ) = CJ*A( I, J )
00205    10          CONTINUE
00206    20       CONTINUE
00207             EQUED = 'C'
00208          END IF
00209       ELSE IF( COLCND.GE.THRESH ) THEN
00210 *
00211 *        Row scaling, no column scaling
00212 *
00213          DO 40 J = 1, N
00214             DO 30 I = 1, M
00215                A( I, J ) = R( I )*A( I, J )
00216    30       CONTINUE
00217    40    CONTINUE
00218          EQUED = 'R'
00219       ELSE
00220 *
00221 *        Row and column scaling
00222 *
00223          DO 60 J = 1, N
00224             CJ = C( J )
00225             DO 50 I = 1, M
00226                A( I, J ) = CJ*R( I )*A( I, J )
00227    50       CONTINUE
00228    60    CONTINUE
00229          EQUED = 'B'
00230       END IF
00231 *
00232       RETURN
00233 *
00234 *     End of SLAQGE
00235 *
00236       END
 All Files Functions