File:  [local] / rpl / lapack / lapack / zlanhb.f
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Jan 26 15:22:45 2010 UTC (14 years, 4 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Initial revision

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

CVSweb interface <joel.bertrand@systella.fr>