Annotation of rpl/lapack/lapack/zlanhb.f, revision 1.18

1.11      bertrand    1: *> \brief \b ZLANHB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a Hermitian band matrix.
1.8       bertrand    2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.15      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.8       bertrand    7: *
                      8: *> \htmlonly
1.15      bertrand    9: *> Download ZLANHB + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlanhb.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlanhb.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlanhb.f">
1.8       bertrand   15: *> [TXT]</a>
1.15      bertrand   16: *> \endhtmlonly
1.8       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       DOUBLE PRECISION FUNCTION ZLANHB( NORM, UPLO, N, K, AB, LDAB,
                     22: *                        WORK )
1.15      bertrand   23: *
1.8       bertrand   24: *       .. Scalar Arguments ..
                     25: *       CHARACTER          NORM, UPLO
                     26: *       INTEGER            K, LDAB, N
                     27: *       ..
                     28: *       .. Array Arguments ..
                     29: *       DOUBLE PRECISION   WORK( * )
                     30: *       COMPLEX*16         AB( LDAB, * )
                     31: *       ..
1.15      bertrand   32: *
1.8       bertrand   33: *
                     34: *> \par Purpose:
                     35: *  =============
                     36: *>
                     37: *> \verbatim
                     38: *>
                     39: *> ZLANHB  returns the value of the one norm,  or the Frobenius norm, or
                     40: *> the  infinity norm,  or the element of  largest absolute value  of an
                     41: *> n by n hermitian band matrix A,  with k super-diagonals.
                     42: *> \endverbatim
                     43: *>
                     44: *> \return ZLANHB
                     45: *> \verbatim
                     46: *>
                     47: *>    ZLANHB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
                     48: *>             (
                     49: *>             ( norm1(A),         NORM = '1', 'O' or 'o'
                     50: *>             (
                     51: *>             ( normI(A),         NORM = 'I' or 'i'
                     52: *>             (
                     53: *>             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
                     54: *>
                     55: *> where  norm1  denotes the  one norm of a matrix (maximum column sum),
                     56: *> normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
                     57: *> normF  denotes the  Frobenius norm of a matrix (square root of sum of
                     58: *> squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
                     59: *> \endverbatim
                     60: *
                     61: *  Arguments:
                     62: *  ==========
                     63: *
                     64: *> \param[in] NORM
                     65: *> \verbatim
                     66: *>          NORM is CHARACTER*1
                     67: *>          Specifies the value to be returned in ZLANHB as described
                     68: *>          above.
                     69: *> \endverbatim
                     70: *>
                     71: *> \param[in] UPLO
                     72: *> \verbatim
                     73: *>          UPLO is CHARACTER*1
                     74: *>          Specifies whether the upper or lower triangular part of the
                     75: *>          band matrix A is supplied.
                     76: *>          = 'U':  Upper triangular
                     77: *>          = 'L':  Lower triangular
                     78: *> \endverbatim
                     79: *>
                     80: *> \param[in] N
                     81: *> \verbatim
                     82: *>          N is INTEGER
                     83: *>          The order of the matrix A.  N >= 0.  When N = 0, ZLANHB is
                     84: *>          set to zero.
                     85: *> \endverbatim
                     86: *>
                     87: *> \param[in] K
                     88: *> \verbatim
                     89: *>          K is INTEGER
                     90: *>          The number of super-diagonals or sub-diagonals of the
                     91: *>          band matrix A.  K >= 0.
                     92: *> \endverbatim
                     93: *>
                     94: *> \param[in] AB
                     95: *> \verbatim
                     96: *>          AB is COMPLEX*16 array, dimension (LDAB,N)
                     97: *>          The upper or lower triangle of the hermitian band matrix A,
                     98: *>          stored in the first K+1 rows of AB.  The j-th column of A is
                     99: *>          stored in the j-th column of the array AB as follows:
                    100: *>          if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
                    101: *>          if UPLO = 'L', AB(1+i-j,j)   = A(i,j) for j<=i<=min(n,j+k).
                    102: *>          Note that the imaginary parts of the diagonal elements need
                    103: *>          not be set and are assumed to be zero.
                    104: *> \endverbatim
                    105: *>
                    106: *> \param[in] LDAB
                    107: *> \verbatim
                    108: *>          LDAB is INTEGER
                    109: *>          The leading dimension of the array AB.  LDAB >= K+1.
                    110: *> \endverbatim
                    111: *>
                    112: *> \param[out] WORK
                    113: *> \verbatim
                    114: *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
                    115: *>          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
                    116: *>          WORK is not referenced.
                    117: *> \endverbatim
                    118: *
                    119: *  Authors:
                    120: *  ========
                    121: *
1.15      bertrand  122: *> \author Univ. of Tennessee
                    123: *> \author Univ. of California Berkeley
                    124: *> \author Univ. of Colorado Denver
                    125: *> \author NAG Ltd.
1.8       bertrand  126: *
1.15      bertrand  127: *> \date December 2016
1.8       bertrand  128: *
                    129: *> \ingroup complex16OTHERauxiliary
                    130: *
                    131: *  =====================================================================
1.1       bertrand  132:       DOUBLE PRECISION FUNCTION ZLANHB( NORM, UPLO, N, K, AB, LDAB,
                    133:      $                 WORK )
                    134: *
1.15      bertrand  135: *  -- LAPACK auxiliary routine (version 3.7.0) --
1.1       bertrand  136: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    137: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.15      bertrand  138: *     December 2016
1.1       bertrand  139: *
1.18    ! bertrand  140:       IMPLICIT NONE
1.1       bertrand  141: *     .. Scalar Arguments ..
                    142:       CHARACTER          NORM, UPLO
                    143:       INTEGER            K, LDAB, N
                    144: *     ..
                    145: *     .. Array Arguments ..
                    146:       DOUBLE PRECISION   WORK( * )
                    147:       COMPLEX*16         AB( LDAB, * )
                    148: *     ..
                    149: *
                    150: * =====================================================================
                    151: *
                    152: *     .. Parameters ..
                    153:       DOUBLE PRECISION   ONE, ZERO
                    154:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
                    155: *     ..
                    156: *     .. Local Scalars ..
                    157:       INTEGER            I, J, L
1.18    ! bertrand  158:       DOUBLE PRECISION   ABSA, SUM, VALUE
        !           159: *     ..
        !           160: *     .. Local Arrays ..
        !           161:       DOUBLE PRECISION   SSQ( 2 ), COLSSQ( 2 )
1.1       bertrand  162: *     ..
                    163: *     .. External Functions ..
1.11      bertrand  164:       LOGICAL            LSAME, DISNAN
                    165:       EXTERNAL           LSAME, DISNAN
1.1       bertrand  166: *     ..
                    167: *     .. External Subroutines ..
1.18    ! bertrand  168:       EXTERNAL           ZLASSQ, DCOMBSSQ
1.1       bertrand  169: *     ..
                    170: *     .. Intrinsic Functions ..
                    171:       INTRINSIC          ABS, DBLE, MAX, MIN, SQRT
                    172: *     ..
                    173: *     .. Executable Statements ..
                    174: *
                    175:       IF( N.EQ.0 ) THEN
                    176:          VALUE = ZERO
                    177:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
                    178: *
                    179: *        Find max(abs(A(i,j))).
                    180: *
                    181:          VALUE = ZERO
                    182:          IF( LSAME( UPLO, 'U' ) ) THEN
                    183:             DO 20 J = 1, N
                    184:                DO 10 I = MAX( K+2-J, 1 ), K
1.11      bertrand  185:                   SUM = ABS( AB( I, J ) )
                    186:                   IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  187:    10          CONTINUE
1.11      bertrand  188:                SUM = ABS( DBLE( AB( K+1, J ) ) )
                    189:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  190:    20       CONTINUE
                    191:          ELSE
                    192:             DO 40 J = 1, N
1.11      bertrand  193:                SUM = ABS( DBLE( AB( 1, J ) ) )
                    194:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  195:                DO 30 I = 2, MIN( N+1-J, K+1 )
1.11      bertrand  196:                   SUM = ABS( AB( I, J ) )
                    197:                   IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  198:    30          CONTINUE
                    199:    40       CONTINUE
                    200:          END IF
                    201:       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
                    202:      $         ( NORM.EQ.'1' ) ) THEN
                    203: *
                    204: *        Find normI(A) ( = norm1(A), since A is hermitian).
                    205: *
                    206:          VALUE = ZERO
                    207:          IF( LSAME( UPLO, 'U' ) ) THEN
                    208:             DO 60 J = 1, N
                    209:                SUM = ZERO
                    210:                L = K + 1 - J
                    211:                DO 50 I = MAX( 1, J-K ), J - 1
                    212:                   ABSA = ABS( AB( L+I, J ) )
                    213:                   SUM = SUM + ABSA
                    214:                   WORK( I ) = WORK( I ) + ABSA
                    215:    50          CONTINUE
                    216:                WORK( J ) = SUM + ABS( DBLE( AB( K+1, J ) ) )
                    217:    60       CONTINUE
                    218:             DO 70 I = 1, N
1.11      bertrand  219:                SUM = WORK( I )
                    220:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  221:    70       CONTINUE
                    222:          ELSE
                    223:             DO 80 I = 1, N
                    224:                WORK( I ) = ZERO
                    225:    80       CONTINUE
                    226:             DO 100 J = 1, N
                    227:                SUM = WORK( J ) + ABS( DBLE( AB( 1, J ) ) )
                    228:                L = 1 - J
                    229:                DO 90 I = J + 1, MIN( N, J+K )
                    230:                   ABSA = ABS( AB( L+I, J ) )
                    231:                   SUM = SUM + ABSA
                    232:                   WORK( I ) = WORK( I ) + ABSA
                    233:    90          CONTINUE
1.11      bertrand  234:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  235:   100       CONTINUE
                    236:          END IF
                    237:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
                    238: *
                    239: *        Find normF(A).
1.18    ! bertrand  240: *        SSQ(1) is scale
        !           241: *        SSQ(2) is sum-of-squares
        !           242: *        For better accuracy, sum each column separately.
        !           243: *
        !           244:          SSQ( 1 ) = ZERO
        !           245:          SSQ( 2 ) = ONE
        !           246: *
        !           247: *        Sum off-diagonals
1.1       bertrand  248: *
                    249:          IF( K.GT.0 ) THEN
                    250:             IF( LSAME( UPLO, 'U' ) ) THEN
                    251:                DO 110 J = 2, N
1.18    ! bertrand  252:                   COLSSQ( 1 ) = ZERO
        !           253:                   COLSSQ( 2 ) = ONE
1.1       bertrand  254:                   CALL ZLASSQ( MIN( J-1, K ), AB( MAX( K+2-J, 1 ), J ),
1.18    ! bertrand  255:      $                         1, COLSSQ( 1 ), COLSSQ( 2 ) )
        !           256:                   CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  257:   110          CONTINUE
                    258:                L = K + 1
                    259:             ELSE
                    260:                DO 120 J = 1, N - 1
1.18    ! bertrand  261:                   COLSSQ( 1 ) = ZERO
        !           262:                   COLSSQ( 2 ) = ONE
        !           263:                   CALL ZLASSQ( MIN( N-J, K ), AB( 2, J ), 1,
        !           264:      $                         COLSSQ( 1 ), COLSSQ( 2 ) )
        !           265:                   CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  266:   120          CONTINUE
                    267:                L = 1
                    268:             END IF
1.18    ! bertrand  269:             SSQ( 2 ) = 2*SSQ( 2 )
1.1       bertrand  270:          ELSE
                    271:             L = 1
                    272:          END IF
1.18    ! bertrand  273: *
        !           274: *        Sum diagonal
        !           275: *
        !           276:          COLSSQ( 1 ) = ZERO
        !           277:          COLSSQ( 2 ) = ONE
1.1       bertrand  278:          DO 130 J = 1, N
                    279:             IF( DBLE( AB( L, J ) ).NE.ZERO ) THEN
                    280:                ABSA = ABS( DBLE( AB( L, J ) ) )
1.18    ! bertrand  281:                IF( COLSSQ( 1 ).LT.ABSA ) THEN
        !           282:                   COLSSQ( 2 ) = ONE + COLSSQ(2)*( COLSSQ(1) / ABSA )**2
        !           283:                   COLSSQ( 1 ) = ABSA
1.1       bertrand  284:                ELSE
1.18    ! bertrand  285:                   COLSSQ( 2 ) = COLSSQ( 2 ) + ( ABSA / COLSSQ( 1 ) )**2
1.1       bertrand  286:                END IF
                    287:             END IF
                    288:   130    CONTINUE
1.18    ! bertrand  289:          CALL DCOMBSSQ( SSQ, COLSSQ )
        !           290:          VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
1.1       bertrand  291:       END IF
                    292: *
                    293:       ZLANHB = VALUE
                    294:       RETURN
                    295: *
                    296: *     End of ZLANHB
                    297: *
                    298:       END

CVSweb interface <joel.bertrand@systella.fr>