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