File:  [local] / rpl / lapack / lapack / zlansb.f
Revision 1.19: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:39:29 2023 UTC (8 months, 3 weeks ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, HEAD
Première mise à jour de lapack et blas.

    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.
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *> \htmlonly
    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">
   15: *> [TXT]</a>
   16: *> \endhtmlonly
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       DOUBLE PRECISION FUNCTION ZLANSB( NORM, UPLO, N, K, AB, LDAB,
   22: *                        WORK )
   23: *
   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: *       ..
   32: *
   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: *
  120: *> \author Univ. of Tennessee
  121: *> \author Univ. of California Berkeley
  122: *> \author Univ. of Colorado Denver
  123: *> \author NAG Ltd.
  124: *
  125: *> \ingroup complex16OTHERauxiliary
  126: *
  127: *  =====================================================================
  128:       DOUBLE PRECISION FUNCTION ZLANSB( NORM, UPLO, N, K, AB, LDAB,
  129:      $                 WORK )
  130: *
  131: *  -- LAPACK auxiliary routine --
  132: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  133: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  134: *
  135: *     .. Scalar Arguments ..
  136:       CHARACTER          NORM, UPLO
  137:       INTEGER            K, LDAB, N
  138: *     ..
  139: *     .. Array Arguments ..
  140:       DOUBLE PRECISION   WORK( * )
  141:       COMPLEX*16         AB( LDAB, * )
  142: *     ..
  143: *
  144: * =====================================================================
  145: *
  146: *     .. Parameters ..
  147:       DOUBLE PRECISION   ONE, ZERO
  148:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
  149: *     ..
  150: *     .. Local Scalars ..
  151:       INTEGER            I, J, L
  152:       DOUBLE PRECISION   ABSA, SCALE, SUM, VALUE
  153: *     ..
  154: *     .. External Functions ..
  155:       LOGICAL            LSAME, DISNAN
  156:       EXTERNAL           LSAME, DISNAN
  157: *     ..
  158: *     .. External Subroutines ..
  159:       EXTERNAL           ZLASSQ
  160: *     ..
  161: *     .. Intrinsic Functions ..
  162:       INTRINSIC          ABS, MAX, MIN, SQRT
  163: *     ..
  164: *     .. Executable Statements ..
  165: *
  166:       IF( N.EQ.0 ) THEN
  167:          VALUE = ZERO
  168:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
  169: *
  170: *        Find max(abs(A(i,j))).
  171: *
  172:          VALUE = ZERO
  173:          IF( LSAME( UPLO, 'U' ) ) THEN
  174:             DO 20 J = 1, N
  175:                DO 10 I = MAX( K+2-J, 1 ), K + 1
  176:                   SUM = ABS( AB( I, J ) )
  177:                   IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  178:    10          CONTINUE
  179:    20       CONTINUE
  180:          ELSE
  181:             DO 40 J = 1, N
  182:                DO 30 I = 1, MIN( N+1-J, K+1 )
  183:                   SUM = ABS( AB( I, J ) )
  184:                   IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  185:    30          CONTINUE
  186:    40       CONTINUE
  187:          END IF
  188:       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
  189:      $         ( NORM.EQ.'1' ) ) THEN
  190: *
  191: *        Find normI(A) ( = norm1(A), since A is symmetric).
  192: *
  193:          VALUE = ZERO
  194:          IF( LSAME( UPLO, 'U' ) ) THEN
  195:             DO 60 J = 1, N
  196:                SUM = ZERO
  197:                L = K + 1 - J
  198:                DO 50 I = MAX( 1, J-K ), J - 1
  199:                   ABSA = ABS( AB( L+I, J ) )
  200:                   SUM = SUM + ABSA
  201:                   WORK( I ) = WORK( I ) + ABSA
  202:    50          CONTINUE
  203:                WORK( J ) = SUM + ABS( AB( K+1, J ) )
  204:    60       CONTINUE
  205:             DO 70 I = 1, N
  206:                SUM = WORK( I )
  207:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  208:    70       CONTINUE
  209:          ELSE
  210:             DO 80 I = 1, N
  211:                WORK( I ) = ZERO
  212:    80       CONTINUE
  213:             DO 100 J = 1, N
  214:                SUM = WORK( J ) + ABS( AB( 1, J ) )
  215:                L = 1 - J
  216:                DO 90 I = J + 1, MIN( N, J+K )
  217:                   ABSA = ABS( AB( L+I, J ) )
  218:                   SUM = SUM + ABSA
  219:                   WORK( I ) = WORK( I ) + ABSA
  220:    90          CONTINUE
  221:                IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
  222:   100       CONTINUE
  223:          END IF
  224:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
  225: *
  226: *        Find normF(A).
  227: *
  228:          SCALE = ZERO
  229:          SUM = ONE
  230:          IF( K.GT.0 ) THEN
  231:             IF( LSAME( UPLO, 'U' ) ) THEN
  232:                DO 110 J = 2, N
  233:                   CALL ZLASSQ( MIN( J-1, K ), AB( MAX( K+2-J, 1 ), J ),
  234:      $                         1, SCALE, SUM )
  235:   110          CONTINUE
  236:                L = K + 1
  237:             ELSE
  238:                DO 120 J = 1, N - 1
  239:                   CALL ZLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
  240:      $                         SUM )
  241:   120          CONTINUE
  242:                L = 1
  243:             END IF
  244:             SUM = 2*SUM
  245:          ELSE
  246:             L = 1
  247:          END IF
  248:          CALL ZLASSQ( N, AB( L, 1 ), LDAB, SCALE, SUM )
  249:          VALUE = SCALE*SQRT( SUM )
  250:       END IF
  251: *
  252:       ZLANSB = VALUE
  253:       RETURN
  254: *
  255: *     End of ZLANSB
  256: *
  257:       END

CVSweb interface <joel.bertrand@systella.fr>