LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dlaqsp.f
Go to the documentation of this file.
00001 *> \brief \b DLAQSP
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DLAQSP + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlaqsp.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlaqsp.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlaqsp.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DLAQSP( UPLO, N, AP, S, SCOND, AMAX, EQUED )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          EQUED, UPLO
00025 *       INTEGER            N
00026 *       DOUBLE PRECISION   AMAX, SCOND
00027 *       ..
00028 *       .. Array Arguments ..
00029 *       DOUBLE PRECISION   AP( * ), S( * )
00030 *       ..
00031 *  
00032 *
00033 *> \par Purpose:
00034 *  =============
00035 *>
00036 *> \verbatim
00037 *>
00038 *> DLAQSP equilibrates a symmetric matrix A using the scaling factors
00039 *> in the vector S.
00040 *> \endverbatim
00041 *
00042 *  Arguments:
00043 *  ==========
00044 *
00045 *> \param[in] UPLO
00046 *> \verbatim
00047 *>          UPLO is CHARACTER*1
00048 *>          Specifies whether the upper or lower triangular part of the
00049 *>          symmetric matrix A is stored.
00050 *>          = 'U':  Upper triangular
00051 *>          = 'L':  Lower triangular
00052 *> \endverbatim
00053 *>
00054 *> \param[in] N
00055 *> \verbatim
00056 *>          N is INTEGER
00057 *>          The order of the matrix A.  N >= 0.
00058 *> \endverbatim
00059 *>
00060 *> \param[in,out] AP
00061 *> \verbatim
00062 *>          AP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
00063 *>          On entry, the upper or lower triangle of the symmetric matrix
00064 *>          A, packed columnwise in a linear array.  The j-th column of A
00065 *>          is stored in the array AP as follows:
00066 *>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
00067 *>          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
00068 *>
00069 *>          On exit, the equilibrated matrix:  diag(S) * A * diag(S), in
00070 *>          the same storage format as A.
00071 *> \endverbatim
00072 *>
00073 *> \param[in] S
00074 *> \verbatim
00075 *>          S is DOUBLE PRECISION array, dimension (N)
00076 *>          The scale factors for A.
00077 *> \endverbatim
00078 *>
00079 *> \param[in] SCOND
00080 *> \verbatim
00081 *>          SCOND is DOUBLE PRECISION
00082 *>          Ratio of the smallest S(i) to the largest S(i).
00083 *> \endverbatim
00084 *>
00085 *> \param[in] AMAX
00086 *> \verbatim
00087 *>          AMAX is DOUBLE PRECISION
00088 *>          Absolute value of largest matrix entry.
00089 *> \endverbatim
00090 *>
00091 *> \param[out] EQUED
00092 *> \verbatim
00093 *>          EQUED is CHARACTER*1
00094 *>          Specifies whether or not equilibration was done.
00095 *>          = 'N':  No equilibration.
00096 *>          = 'Y':  Equilibration was done, i.e., A has been replaced by
00097 *>                  diag(S) * A * diag(S).
00098 *> \endverbatim
00099 *
00100 *> \par Internal Parameters:
00101 *  =========================
00102 *>
00103 *> \verbatim
00104 *>  THRESH is a threshold value used to decide if scaling should be done
00105 *>  based on the ratio of the scaling factors.  If SCOND < THRESH,
00106 *>  scaling is done.
00107 *>
00108 *>  LARGE and SMALL are threshold values used to decide if scaling should
00109 *>  be done based on the absolute size of the largest matrix element.
00110 *>  If AMAX > LARGE or AMAX < SMALL, scaling is done.
00111 *> \endverbatim
00112 *
00113 *  Authors:
00114 *  ========
00115 *
00116 *> \author Univ. of Tennessee 
00117 *> \author Univ. of California Berkeley 
00118 *> \author Univ. of Colorado Denver 
00119 *> \author NAG Ltd. 
00120 *
00121 *> \date November 2011
00122 *
00123 *> \ingroup doubleOTHERauxiliary
00124 *
00125 *  =====================================================================
00126       SUBROUTINE DLAQSP( UPLO, N, AP, S, SCOND, AMAX, EQUED )
00127 *
00128 *  -- LAPACK auxiliary routine (version 3.4.0) --
00129 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00130 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00131 *     November 2011
00132 *
00133 *     .. Scalar Arguments ..
00134       CHARACTER          EQUED, UPLO
00135       INTEGER            N
00136       DOUBLE PRECISION   AMAX, SCOND
00137 *     ..
00138 *     .. Array Arguments ..
00139       DOUBLE PRECISION   AP( * ), S( * )
00140 *     ..
00141 *
00142 *  =====================================================================
00143 *
00144 *     .. Parameters ..
00145       DOUBLE PRECISION   ONE, THRESH
00146       PARAMETER          ( ONE = 1.0D+0, THRESH = 0.1D+0 )
00147 *     ..
00148 *     .. Local Scalars ..
00149       INTEGER            I, J, JC
00150       DOUBLE PRECISION   CJ, LARGE, SMALL
00151 *     ..
00152 *     .. External Functions ..
00153       LOGICAL            LSAME
00154       DOUBLE PRECISION   DLAMCH
00155       EXTERNAL           LSAME, DLAMCH
00156 *     ..
00157 *     .. Executable Statements ..
00158 *
00159 *     Quick return if possible
00160 *
00161       IF( N.LE.0 ) THEN
00162          EQUED = 'N'
00163          RETURN
00164       END IF
00165 *
00166 *     Initialize LARGE and SMALL.
00167 *
00168       SMALL = DLAMCH( 'Safe minimum' ) / DLAMCH( 'Precision' )
00169       LARGE = ONE / SMALL
00170 *
00171       IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN
00172 *
00173 *        No equilibration
00174 *
00175          EQUED = 'N'
00176       ELSE
00177 *
00178 *        Replace A by diag(S) * A * diag(S).
00179 *
00180          IF( LSAME( UPLO, 'U' ) ) THEN
00181 *
00182 *           Upper triangle of A is stored.
00183 *
00184             JC = 1
00185             DO 20 J = 1, N
00186                CJ = S( J )
00187                DO 10 I = 1, J
00188                   AP( JC+I-1 ) = CJ*S( I )*AP( JC+I-1 )
00189    10          CONTINUE
00190                JC = JC + J
00191    20       CONTINUE
00192          ELSE
00193 *
00194 *           Lower triangle of A is stored.
00195 *
00196             JC = 1
00197             DO 40 J = 1, N
00198                CJ = S( J )
00199                DO 30 I = J, N
00200                   AP( JC+I-J ) = CJ*S( I )*AP( JC+I-J )
00201    30          CONTINUE
00202                JC = JC + N - J + 1
00203    40       CONTINUE
00204          END IF
00205          EQUED = 'Y'
00206       END IF
00207 *
00208       RETURN
00209 *
00210 *     End of DLAQSP
00211 *
00212       END
 All Files Functions