LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
zlanhp.f
Go to the documentation of this file.
00001 *> \brief \b ZLANHP
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download ZLANHP + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlanhp.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlanhp.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlanhp.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       DOUBLE PRECISION FUNCTION ZLANHP( NORM, UPLO, N, AP, WORK )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          NORM, UPLO
00025 *       INTEGER            N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       DOUBLE PRECISION   WORK( * )
00029 *       COMPLEX*16         AP( * )
00030 *       ..
00031 *  
00032 *
00033 *> \par Purpose:
00034 *  =============
00035 *>
00036 *> \verbatim
00037 *>
00038 *> ZLANHP  returns the value of the one norm,  or the Frobenius norm, or
00039 *> the  infinity norm,  or the  element of  largest absolute value  of a
00040 *> complex hermitian matrix A,  supplied in packed form.
00041 *> \endverbatim
00042 *>
00043 *> \return ZLANHP
00044 *> \verbatim
00045 *>
00046 *>    ZLANHP = ( max(abs(A(i,j))), NORM = 'M' or 'm'
00047 *>             (
00048 *>             ( norm1(A),         NORM = '1', 'O' or 'o'
00049 *>             (
00050 *>             ( normI(A),         NORM = 'I' or 'i'
00051 *>             (
00052 *>             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
00053 *>
00054 *> where  norm1  denotes the  one norm of a matrix (maximum column sum),
00055 *> normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
00056 *> normF  denotes the  Frobenius norm of a matrix (square root of sum of
00057 *> squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
00058 *> \endverbatim
00059 *
00060 *  Arguments:
00061 *  ==========
00062 *
00063 *> \param[in] NORM
00064 *> \verbatim
00065 *>          NORM is CHARACTER*1
00066 *>          Specifies the value to be returned in ZLANHP as described
00067 *>          above.
00068 *> \endverbatim
00069 *>
00070 *> \param[in] UPLO
00071 *> \verbatim
00072 *>          UPLO is CHARACTER*1
00073 *>          Specifies whether the upper or lower triangular part of the
00074 *>          hermitian matrix A is supplied.
00075 *>          = 'U':  Upper triangular part of A is supplied
00076 *>          = 'L':  Lower triangular part of A is supplied
00077 *> \endverbatim
00078 *>
00079 *> \param[in] N
00080 *> \verbatim
00081 *>          N is INTEGER
00082 *>          The order of the matrix A.  N >= 0.  When N = 0, ZLANHP is
00083 *>          set to zero.
00084 *> \endverbatim
00085 *>
00086 *> \param[in] AP
00087 *> \verbatim
00088 *>          AP is COMPLEX*16 array, dimension (N*(N+1)/2)
00089 *>          The upper or lower triangle of the hermitian matrix A, packed
00090 *>          columnwise in a linear array.  The j-th column of A is stored
00091 *>          in the array AP as follows:
00092 *>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
00093 *>          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
00094 *>          Note that the  imaginary parts of the diagonal elements need
00095 *>          not be set and are assumed to be zero.
00096 *> \endverbatim
00097 *>
00098 *> \param[out] WORK
00099 *> \verbatim
00100 *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
00101 *>          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
00102 *>          WORK is not referenced.
00103 *> \endverbatim
00104 *
00105 *  Authors:
00106 *  ========
00107 *
00108 *> \author Univ. of Tennessee 
00109 *> \author Univ. of California Berkeley 
00110 *> \author Univ. of Colorado Denver 
00111 *> \author NAG Ltd. 
00112 *
00113 *> \date November 2011
00114 *
00115 *> \ingroup complex16OTHERauxiliary
00116 *
00117 *  =====================================================================
00118       DOUBLE PRECISION FUNCTION ZLANHP( NORM, UPLO, N, AP, WORK )
00119 *
00120 *  -- LAPACK auxiliary routine (version 3.4.0) --
00121 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00122 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00123 *     November 2011
00124 *
00125 *     .. Scalar Arguments ..
00126       CHARACTER          NORM, UPLO
00127       INTEGER            N
00128 *     ..
00129 *     .. Array Arguments ..
00130       DOUBLE PRECISION   WORK( * )
00131       COMPLEX*16         AP( * )
00132 *     ..
00133 *
00134 * =====================================================================
00135 *
00136 *     .. Parameters ..
00137       DOUBLE PRECISION   ONE, ZERO
00138       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00139 *     ..
00140 *     .. Local Scalars ..
00141       INTEGER            I, J, K
00142       DOUBLE PRECISION   ABSA, SCALE, SUM, VALUE
00143 *     ..
00144 *     .. External Functions ..
00145       LOGICAL            LSAME
00146       EXTERNAL           LSAME
00147 *     ..
00148 *     .. External Subroutines ..
00149       EXTERNAL           ZLASSQ
00150 *     ..
00151 *     .. Intrinsic Functions ..
00152       INTRINSIC          ABS, DBLE, MAX, SQRT
00153 *     ..
00154 *     .. Executable Statements ..
00155 *
00156       IF( N.EQ.0 ) THEN
00157          VALUE = ZERO
00158       ELSE IF( LSAME( NORM, 'M' ) ) THEN
00159 *
00160 *        Find max(abs(A(i,j))).
00161 *
00162          VALUE = ZERO
00163          IF( LSAME( UPLO, 'U' ) ) THEN
00164             K = 0
00165             DO 20 J = 1, N
00166                DO 10 I = K + 1, K + J - 1
00167                   VALUE = MAX( VALUE, ABS( AP( I ) ) )
00168    10          CONTINUE
00169                K = K + J
00170                VALUE = MAX( VALUE, ABS( DBLE( AP( K ) ) ) )
00171    20       CONTINUE
00172          ELSE
00173             K = 1
00174             DO 40 J = 1, N
00175                VALUE = MAX( VALUE, ABS( DBLE( AP( K ) ) ) )
00176                DO 30 I = K + 1, K + N - J
00177                   VALUE = MAX( VALUE, ABS( AP( I ) ) )
00178    30          CONTINUE
00179                K = K + N - J + 1
00180    40       CONTINUE
00181          END IF
00182       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
00183      $         ( NORM.EQ.'1' ) ) THEN
00184 *
00185 *        Find normI(A) ( = norm1(A), since A is hermitian).
00186 *
00187          VALUE = ZERO
00188          K = 1
00189          IF( LSAME( UPLO, 'U' ) ) THEN
00190             DO 60 J = 1, N
00191                SUM = ZERO
00192                DO 50 I = 1, J - 1
00193                   ABSA = ABS( AP( K ) )
00194                   SUM = SUM + ABSA
00195                   WORK( I ) = WORK( I ) + ABSA
00196                   K = K + 1
00197    50          CONTINUE
00198                WORK( J ) = SUM + ABS( DBLE( AP( K ) ) )
00199                K = K + 1
00200    60       CONTINUE
00201             DO 70 I = 1, N
00202                VALUE = MAX( VALUE, WORK( I ) )
00203    70       CONTINUE
00204          ELSE
00205             DO 80 I = 1, N
00206                WORK( I ) = ZERO
00207    80       CONTINUE
00208             DO 100 J = 1, N
00209                SUM = WORK( J ) + ABS( DBLE( AP( K ) ) )
00210                K = K + 1
00211                DO 90 I = J + 1, N
00212                   ABSA = ABS( AP( K ) )
00213                   SUM = SUM + ABSA
00214                   WORK( I ) = WORK( I ) + ABSA
00215                   K = K + 1
00216    90          CONTINUE
00217                VALUE = MAX( VALUE, SUM )
00218   100       CONTINUE
00219          END IF
00220       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
00221 *
00222 *        Find normF(A).
00223 *
00224          SCALE = ZERO
00225          SUM = ONE
00226          K = 2
00227          IF( LSAME( UPLO, 'U' ) ) THEN
00228             DO 110 J = 2, N
00229                CALL ZLASSQ( J-1, AP( K ), 1, SCALE, SUM )
00230                K = K + J
00231   110       CONTINUE
00232          ELSE
00233             DO 120 J = 1, N - 1
00234                CALL ZLASSQ( N-J, AP( K ), 1, SCALE, SUM )
00235                K = K + N - J + 1
00236   120       CONTINUE
00237          END IF
00238          SUM = 2*SUM
00239          K = 1
00240          DO 130 I = 1, N
00241             IF( DBLE( AP( K ) ).NE.ZERO ) THEN
00242                ABSA = ABS( DBLE( AP( K ) ) )
00243                IF( SCALE.LT.ABSA ) THEN
00244                   SUM = ONE + SUM*( SCALE / ABSA )**2
00245                   SCALE = ABSA
00246                ELSE
00247                   SUM = SUM + ( ABSA / SCALE )**2
00248                END IF
00249             END IF
00250             IF( LSAME( UPLO, 'U' ) ) THEN
00251                K = K + I + 1
00252             ELSE
00253                K = K + N - I + 1
00254             END IF
00255   130    CONTINUE
00256          VALUE = SCALE*SQRT( SUM )
00257       END IF
00258 *
00259       ZLANHP = VALUE
00260       RETURN
00261 *
00262 *     End of ZLANHP
00263 *
00264       END
 All Files Functions