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

1.11      bertrand    1: *> \brief \b ZLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric 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 ZLANSB + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlansb.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlansb.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlansb.f">
1.8       bertrand   15: *> [TXT]</a>
1.15      bertrand   16: *> \endhtmlonly
1.8       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       DOUBLE PRECISION FUNCTION ZLANSB( 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: *> ZLANSB  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 symmetric band matrix A,  with k super-diagonals.
                     42: *> \endverbatim
                     43: *>
                     44: *> \return ZLANSB
                     45: *> \verbatim
                     46: *>
                     47: *>    ZLANSB = ( 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 ZLANSB 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 part is supplied
                     77: *>          = 'L':  Lower triangular part is supplied
                     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, ZLANSB 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 symmetric 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: *> \endverbatim
                    103: *>
                    104: *> \param[in] LDAB
                    105: *> \verbatim
                    106: *>          LDAB is INTEGER
                    107: *>          The leading dimension of the array AB.  LDAB >= K+1.
                    108: *> \endverbatim
                    109: *>
                    110: *> \param[out] WORK
                    111: *> \verbatim
                    112: *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
                    113: *>          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
                    114: *>          WORK is not referenced.
                    115: *> \endverbatim
                    116: *
                    117: *  Authors:
                    118: *  ========
                    119: *
1.15      bertrand  120: *> \author Univ. of Tennessee
                    121: *> \author Univ. of California Berkeley
                    122: *> \author Univ. of Colorado Denver
                    123: *> \author NAG Ltd.
1.8       bertrand  124: *
1.15      bertrand  125: *> \date December 2016
1.8       bertrand  126: *
                    127: *> \ingroup complex16OTHERauxiliary
                    128: *
                    129: *  =====================================================================
1.1       bertrand  130:       DOUBLE PRECISION FUNCTION ZLANSB( NORM, UPLO, N, K, AB, LDAB,
                    131:      $                 WORK )
                    132: *
1.15      bertrand  133: *  -- LAPACK auxiliary routine (version 3.7.0) --
1.1       bertrand  134: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    135: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.15      bertrand  136: *     December 2016
1.1       bertrand  137: *
1.18    ! bertrand  138:       IMPLICIT NONE
1.1       bertrand  139: *     .. Scalar Arguments ..
                    140:       CHARACTER          NORM, UPLO
                    141:       INTEGER            K, LDAB, N
                    142: *     ..
                    143: *     .. Array Arguments ..
                    144:       DOUBLE PRECISION   WORK( * )
                    145:       COMPLEX*16         AB( LDAB, * )
                    146: *     ..
                    147: *
                    148: * =====================================================================
                    149: *
                    150: *     .. Parameters ..
                    151:       DOUBLE PRECISION   ONE, ZERO
                    152:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
                    153: *     ..
                    154: *     .. Local Scalars ..
                    155:       INTEGER            I, J, L
1.18    ! bertrand  156:       DOUBLE PRECISION   ABSA, SUM, VALUE
        !           157: *     ..
        !           158: *     .. Local Arrays ..
        !           159:       DOUBLE PRECISION   SSQ( 2 ), COLSSQ( 2 )
1.1       bertrand  160: *     ..
                    161: *     .. External Functions ..
1.11      bertrand  162:       LOGICAL            LSAME, DISNAN
                    163:       EXTERNAL           LSAME, DISNAN
1.1       bertrand  164: *     ..
                    165: *     .. External Subroutines ..
1.18    ! bertrand  166:       EXTERNAL           ZLASSQ, DCOMBSSQ
1.1       bertrand  167: *     ..
                    168: *     .. Intrinsic Functions ..
                    169:       INTRINSIC          ABS, MAX, MIN, SQRT
                    170: *     ..
                    171: *     .. Executable Statements ..
                    172: *
                    173:       IF( N.EQ.0 ) THEN
                    174:          VALUE = ZERO
                    175:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
                    176: *
                    177: *        Find max(abs(A(i,j))).
                    178: *
                    179:          VALUE = ZERO
                    180:          IF( LSAME( UPLO, 'U' ) ) THEN
                    181:             DO 20 J = 1, N
                    182:                DO 10 I = MAX( K+2-J, 1 ), K + 1
1.11      bertrand  183:                   SUM = ABS( AB( I, J ) )
                    184:                   IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  185:    10          CONTINUE
                    186:    20       CONTINUE
                    187:          ELSE
                    188:             DO 40 J = 1, N
                    189:                DO 30 I = 1, MIN( N+1-J, K+1 )
1.11      bertrand  190:                   SUM = ABS( AB( I, J ) )
                    191:                   IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  192:    30          CONTINUE
                    193:    40       CONTINUE
                    194:          END IF
                    195:       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
                    196:      $         ( NORM.EQ.'1' ) ) THEN
                    197: *
                    198: *        Find normI(A) ( = norm1(A), since A is symmetric).
                    199: *
                    200:          VALUE = ZERO
                    201:          IF( LSAME( UPLO, 'U' ) ) THEN
                    202:             DO 60 J = 1, N
                    203:                SUM = ZERO
                    204:                L = K + 1 - J
                    205:                DO 50 I = MAX( 1, J-K ), J - 1
                    206:                   ABSA = ABS( AB( L+I, J ) )
                    207:                   SUM = SUM + ABSA
                    208:                   WORK( I ) = WORK( I ) + ABSA
                    209:    50          CONTINUE
                    210:                WORK( J ) = SUM + ABS( AB( K+1, J ) )
                    211:    60       CONTINUE
                    212:             DO 70 I = 1, N
1.11      bertrand  213:                SUM = WORK( I )
                    214:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  215:    70       CONTINUE
                    216:          ELSE
                    217:             DO 80 I = 1, N
                    218:                WORK( I ) = ZERO
                    219:    80       CONTINUE
                    220:             DO 100 J = 1, N
                    221:                SUM = WORK( J ) + ABS( AB( 1, J ) )
                    222:                L = 1 - J
                    223:                DO 90 I = J + 1, MIN( N, J+K )
                    224:                   ABSA = ABS( AB( L+I, J ) )
                    225:                   SUM = SUM + ABSA
                    226:                   WORK( I ) = WORK( I ) + ABSA
                    227:    90          CONTINUE
1.11      bertrand  228:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
1.1       bertrand  229:   100       CONTINUE
                    230:          END IF
                    231:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
                    232: *
                    233: *        Find normF(A).
1.18    ! bertrand  234: *        SSQ(1) is scale
        !           235: *        SSQ(2) is sum-of-squares
        !           236: *        For better accuracy, sum each column separately.
        !           237: *
        !           238:          SSQ( 1 ) = ZERO
        !           239:          SSQ( 2 ) = ONE
        !           240: *
        !           241: *        Sum off-diagonals
1.1       bertrand  242: *
                    243:          IF( K.GT.0 ) THEN
                    244:             IF( LSAME( UPLO, 'U' ) ) THEN
                    245:                DO 110 J = 2, N
1.18    ! bertrand  246:                   COLSSQ( 1 ) = ZERO
        !           247:                   COLSSQ( 2 ) = ONE
1.1       bertrand  248:                   CALL ZLASSQ( MIN( J-1, K ), AB( MAX( K+2-J, 1 ), J ),
1.18    ! bertrand  249:      $                         1, COLSSQ( 1 ), COLSSQ( 2 ) )
        !           250:                   CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  251:   110          CONTINUE
                    252:                L = K + 1
                    253:             ELSE
                    254:                DO 120 J = 1, N - 1
1.18    ! bertrand  255:                   COLSSQ( 1 ) = ZERO
        !           256:                   COLSSQ( 2 ) = ONE
        !           257:                   CALL ZLASSQ( MIN( N-J, K ), AB( 2, J ), 1,
        !           258:      $                         COLSSQ( 1 ), COLSSQ( 2 ) )
        !           259:                   CALL DCOMBSSQ( SSQ, COLSSQ )
1.1       bertrand  260:   120          CONTINUE
                    261:                L = 1
                    262:             END IF
1.18    ! bertrand  263:             SSQ( 2 ) = 2*SSQ( 2 )
1.1       bertrand  264:          ELSE
                    265:             L = 1
                    266:          END IF
1.18    ! bertrand  267: *
        !           268: *        Sum diagonal
        !           269: *
        !           270:          COLSSQ( 1 ) = ZERO
        !           271:          COLSSQ( 2 ) = ONE
        !           272:          CALL ZLASSQ( N, AB( L, 1 ), LDAB, COLSSQ( 1 ), COLSSQ( 2 ) )
        !           273:          CALL DCOMBSSQ( SSQ, COLSSQ )
        !           274:          VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
1.1       bertrand  275:       END IF
                    276: *
                    277:       ZLANSB = VALUE
                    278:       RETURN
                    279: *
                    280: *     End of ZLANSB
                    281: *
                    282:       END

CVSweb interface <joel.bertrand@systella.fr>