File:  [local] / rpl / lapack / lapack / zlanhp.f
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Jan 26 15:22:46 2010 UTC (14 years, 4 months ago) by bertrand
Branches: JKB
CVS tags: start, rpl-4_0_14, rpl-4_0_13, rpl-4_0_12, rpl-4_0_11, rpl-4_0_10


Commit initial.

    1:       DOUBLE PRECISION FUNCTION ZLANHP( NORM, UPLO, N, AP, WORK )
    2: *
    3: *  -- LAPACK auxiliary routine (version 3.2) --
    4: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
    5: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
    6: *     November 2006
    7: *
    8: *     .. Scalar Arguments ..
    9:       CHARACTER          NORM, UPLO
   10:       INTEGER            N
   11: *     ..
   12: *     .. Array Arguments ..
   13:       DOUBLE PRECISION   WORK( * )
   14:       COMPLEX*16         AP( * )
   15: *     ..
   16: *
   17: *  Purpose
   18: *  =======
   19: *
   20: *  ZLANHP  returns the value of the one norm,  or the Frobenius norm, or
   21: *  the  infinity norm,  or the  element of  largest absolute value  of a
   22: *  complex hermitian matrix A,  supplied in packed form.
   23: *
   24: *  Description
   25: *  ===========
   26: *
   27: *  ZLANHP returns the value
   28: *
   29: *     ZLANHP = ( max(abs(A(i,j))), NORM = 'M' or 'm'
   30: *              (
   31: *              ( norm1(A),         NORM = '1', 'O' or 'o'
   32: *              (
   33: *              ( normI(A),         NORM = 'I' or 'i'
   34: *              (
   35: *              ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
   36: *
   37: *  where  norm1  denotes the  one norm of a matrix (maximum column sum),
   38: *  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
   39: *  normF  denotes the  Frobenius norm of a matrix (square root of sum of
   40: *  squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
   41: *
   42: *  Arguments
   43: *  =========
   44: *
   45: *  NORM    (input) CHARACTER*1
   46: *          Specifies the value to be returned in ZLANHP as described
   47: *          above.
   48: *
   49: *  UPLO    (input) CHARACTER*1
   50: *          Specifies whether the upper or lower triangular part of the
   51: *          hermitian matrix A is supplied.
   52: *          = 'U':  Upper triangular part of A is supplied
   53: *          = 'L':  Lower triangular part of A is supplied
   54: *
   55: *  N       (input) INTEGER
   56: *          The order of the matrix A.  N >= 0.  When N = 0, ZLANHP is
   57: *          set to zero.
   58: *
   59: *  AP      (input) COMPLEX*16 array, dimension (N*(N+1)/2)
   60: *          The upper or lower triangle of the hermitian matrix A, packed
   61: *          columnwise in a linear array.  The j-th column of A is stored
   62: *          in the array AP as follows:
   63: *          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
   64: *          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
   65: *          Note that the  imaginary parts of the diagonal elements need
   66: *          not be set and are assumed to be zero.
   67: *
   68: *  WORK    (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
   69: *          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
   70: *          WORK is not referenced.
   71: *
   72: * =====================================================================
   73: *
   74: *     .. Parameters ..
   75:       DOUBLE PRECISION   ONE, ZERO
   76:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
   77: *     ..
   78: *     .. Local Scalars ..
   79:       INTEGER            I, J, K
   80:       DOUBLE PRECISION   ABSA, SCALE, SUM, VALUE
   81: *     ..
   82: *     .. External Functions ..
   83:       LOGICAL            LSAME
   84:       EXTERNAL           LSAME
   85: *     ..
   86: *     .. External Subroutines ..
   87:       EXTERNAL           ZLASSQ
   88: *     ..
   89: *     .. Intrinsic Functions ..
   90:       INTRINSIC          ABS, DBLE, MAX, SQRT
   91: *     ..
   92: *     .. Executable Statements ..
   93: *
   94:       IF( N.EQ.0 ) THEN
   95:          VALUE = ZERO
   96:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
   97: *
   98: *        Find max(abs(A(i,j))).
   99: *
  100:          VALUE = ZERO
  101:          IF( LSAME( UPLO, 'U' ) ) THEN
  102:             K = 0
  103:             DO 20 J = 1, N
  104:                DO 10 I = K + 1, K + J - 1
  105:                   VALUE = MAX( VALUE, ABS( AP( I ) ) )
  106:    10          CONTINUE
  107:                K = K + J
  108:                VALUE = MAX( VALUE, ABS( DBLE( AP( K ) ) ) )
  109:    20       CONTINUE
  110:          ELSE
  111:             K = 1
  112:             DO 40 J = 1, N
  113:                VALUE = MAX( VALUE, ABS( DBLE( AP( K ) ) ) )
  114:                DO 30 I = K + 1, K + N - J
  115:                   VALUE = MAX( VALUE, ABS( AP( I ) ) )
  116:    30          CONTINUE
  117:                K = K + N - J + 1
  118:    40       CONTINUE
  119:          END IF
  120:       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
  121:      $         ( NORM.EQ.'1' ) ) THEN
  122: *
  123: *        Find normI(A) ( = norm1(A), since A is hermitian).
  124: *
  125:          VALUE = ZERO
  126:          K = 1
  127:          IF( LSAME( UPLO, 'U' ) ) THEN
  128:             DO 60 J = 1, N
  129:                SUM = ZERO
  130:                DO 50 I = 1, J - 1
  131:                   ABSA = ABS( AP( K ) )
  132:                   SUM = SUM + ABSA
  133:                   WORK( I ) = WORK( I ) + ABSA
  134:                   K = K + 1
  135:    50          CONTINUE
  136:                WORK( J ) = SUM + ABS( DBLE( AP( K ) ) )
  137:                K = K + 1
  138:    60       CONTINUE
  139:             DO 70 I = 1, N
  140:                VALUE = MAX( VALUE, WORK( I ) )
  141:    70       CONTINUE
  142:          ELSE
  143:             DO 80 I = 1, N
  144:                WORK( I ) = ZERO
  145:    80       CONTINUE
  146:             DO 100 J = 1, N
  147:                SUM = WORK( J ) + ABS( DBLE( AP( K ) ) )
  148:                K = K + 1
  149:                DO 90 I = J + 1, N
  150:                   ABSA = ABS( AP( K ) )
  151:                   SUM = SUM + ABSA
  152:                   WORK( I ) = WORK( I ) + ABSA
  153:                   K = K + 1
  154:    90          CONTINUE
  155:                VALUE = MAX( VALUE, SUM )
  156:   100       CONTINUE
  157:          END IF
  158:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
  159: *
  160: *        Find normF(A).
  161: *
  162:          SCALE = ZERO
  163:          SUM = ONE
  164:          K = 2
  165:          IF( LSAME( UPLO, 'U' ) ) THEN
  166:             DO 110 J = 2, N
  167:                CALL ZLASSQ( J-1, AP( K ), 1, SCALE, SUM )
  168:                K = K + J
  169:   110       CONTINUE
  170:          ELSE
  171:             DO 120 J = 1, N - 1
  172:                CALL ZLASSQ( N-J, AP( K ), 1, SCALE, SUM )
  173:                K = K + N - J + 1
  174:   120       CONTINUE
  175:          END IF
  176:          SUM = 2*SUM
  177:          K = 1
  178:          DO 130 I = 1, N
  179:             IF( DBLE( AP( K ) ).NE.ZERO ) THEN
  180:                ABSA = ABS( DBLE( AP( K ) ) )
  181:                IF( SCALE.LT.ABSA ) THEN
  182:                   SUM = ONE + SUM*( SCALE / ABSA )**2
  183:                   SCALE = ABSA
  184:                ELSE
  185:                   SUM = SUM + ( ABSA / SCALE )**2
  186:                END IF
  187:             END IF
  188:             IF( LSAME( UPLO, 'U' ) ) THEN
  189:                K = K + I + 1
  190:             ELSE
  191:                K = K + N - I + 1
  192:             END IF
  193:   130    CONTINUE
  194:          VALUE = SCALE*SQRT( SUM )
  195:       END IF
  196: *
  197:       ZLANHP = VALUE
  198:       RETURN
  199: *
  200: *     End of ZLANHP
  201: *
  202:       END

CVSweb interface <joel.bertrand@systella.fr>