1 *> \brief \b ZLAQHP scales a Hermitian matrix stored in packed form.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZLAQHP + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlaqhp.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlaqhp.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlaqhp.f">
21 * SUBROUTINE ZLAQHP( UPLO, N, AP, S, SCOND, AMAX, EQUED )
23 * .. Scalar Arguments ..
24 * CHARACTER EQUED, UPLO
26 * DOUBLE PRECISION AMAX, SCOND
28 * .. Array Arguments ..
29 * DOUBLE PRECISION S( * )
39 *> ZLAQHP equilibrates a Hermitian matrix A using the scaling factors
48 *> UPLO is CHARACTER*1
49 *> Specifies whether the upper or lower triangular part of the
50 *> Hermitian matrix A is stored.
51 *> = 'U': Upper triangular
52 *> = 'L': Lower triangular
58 *> The order of the matrix A. N >= 0.
63 *> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
64 *> On entry, the upper or lower triangle of the Hermitian matrix
65 *> A, packed columnwise in a linear array. The j-th column of A
66 *> is stored in the array AP as follows:
67 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
68 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
70 *> On exit, the equilibrated matrix: diag(S) * A * diag(S), in
71 *> the same storage format as A.
76 *> S is DOUBLE PRECISION array, dimension (N)
77 *> The scale factors for A.
82 *> SCOND is DOUBLE PRECISION
83 *> Ratio of the smallest S(i) to the largest S(i).
88 *> AMAX is DOUBLE PRECISION
89 *> Absolute value of largest matrix entry.
94 *> EQUED is CHARACTER*1
95 *> Specifies whether or not equilibration was done.
96 *> = 'N': No equilibration.
97 *> = 'Y': Equilibration was done, i.e., A has been replaced by
98 *> diag(S) * A * diag(S).
101 *> \par Internal Parameters:
102 * =========================
105 *> THRESH is a threshold value used to decide if scaling should be done
106 *> based on the ratio of the scaling factors. If SCOND < THRESH,
109 *> LARGE and SMALL are threshold values used to decide if scaling should
110 *> be done based on the absolute size of the largest matrix element.
111 *> If AMAX > LARGE or AMAX < SMALL, scaling is done.
117 *> \author Univ. of Tennessee
118 *> \author Univ. of California Berkeley
119 *> \author Univ. of Colorado Denver
122 *> \date September 2012
124 *> \ingroup complex16OTHERauxiliary
126 * =====================================================================
127 SUBROUTINE ZLAQHP( UPLO, N, AP, S, SCOND, AMAX, EQUED )
129 * -- LAPACK auxiliary routine (version 3.4.2) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
134 * .. Scalar Arguments ..
135 CHARACTER EQUED, UPLO
137 DOUBLE PRECISION AMAX, SCOND
139 * .. Array Arguments ..
140 DOUBLE PRECISION S( * )
144 * =====================================================================
147 DOUBLE PRECISION ONE, THRESH
148 PARAMETER ( ONE = 1.0D+0, THRESH = 0.1D+0 )
150 * .. Local Scalars ..
152 DOUBLE PRECISION CJ, LARGE, SMALL
154 * .. External Functions ..
156 DOUBLE PRECISION DLAMCH
157 EXTERNAL LSAME, DLAMCH
159 * .. Intrinsic Functions ..
162 * .. Executable Statements ..
164 * Quick return if possible
171 * Initialize LARGE and SMALL.
173 SMALL = DLAMCH( 'Safe minimum' ) / DLAMCH( 'Precision' )
176 IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN
183 * Replace A by diag(S) * A * diag(S).
185 IF( LSAME( UPLO, 'U' ) ) THEN
187 * Upper triangle of A is stored.
193 AP( JC+I-1 ) = CJ*S( I )*AP( JC+I-1 )
195 AP( JC+J-1 ) = CJ*CJ*DBLE( AP( JC+J-1 ) )
200 * Lower triangle of A is stored.
205 AP( JC ) = CJ*CJ*DBLE( AP( JC ) )
207 AP( JC+I-J ) = CJ*S( I )*AP( JC+I-J )