LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
claqhp.f
Go to the documentation of this file.
00001 *> \brief \b CLAQHP
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CLAQHP + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/claqhp.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/claqhp.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/claqhp.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE CLAQHP( 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 *> CLAQHP equilibrates a Hermitian 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 *>          Hermitian 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 Hermitian 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 CLAQHP( 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 *     .. Intrinsic Functions ..
00160       INTRINSIC          REAL
00161 *     ..
00162 *     .. Executable Statements ..
00163 *
00164 *     Quick return if possible
00165 *
00166       IF( N.LE.0 ) THEN
00167          EQUED = 'N'
00168          RETURN
00169       END IF
00170 *
00171 *     Initialize LARGE and SMALL.
00172 *
00173       SMALL = SLAMCH( 'Safe minimum' ) / SLAMCH( 'Precision' )
00174       LARGE = ONE / SMALL
00175 *
00176       IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN
00177 *
00178 *        No equilibration
00179 *
00180          EQUED = 'N'
00181       ELSE
00182 *
00183 *        Replace A by diag(S) * A * diag(S).
00184 *
00185          IF( LSAME( UPLO, 'U' ) ) THEN
00186 *
00187 *           Upper triangle of A is stored.
00188 *
00189             JC = 1
00190             DO 20 J = 1, N
00191                CJ = S( J )
00192                DO 10 I = 1, J - 1
00193                   AP( JC+I-1 ) = CJ*S( I )*AP( JC+I-1 )
00194    10          CONTINUE
00195                AP( JC+J-1 ) = CJ*CJ*REAL( AP( JC+J-1 ) )
00196                JC = JC + J
00197    20       CONTINUE
00198          ELSE
00199 *
00200 *           Lower triangle of A is stored.
00201 *
00202             JC = 1
00203             DO 40 J = 1, N
00204                CJ = S( J )
00205                AP( JC ) = CJ*CJ*REAL( AP( JC ) )
00206                DO 30 I = J + 1, N
00207                   AP( JC+I-J ) = CJ*S( I )*AP( JC+I-J )
00208    30          CONTINUE
00209                JC = JC + N - J + 1
00210    40       CONTINUE
00211          END IF
00212          EQUED = 'Y'
00213       END IF
00214 *
00215       RETURN
00216 *
00217 *     End of CLAQHP
00218 *
00219       END
 All Files Functions