File:  [local] / rpl / lapack / lapack / dlansb.f
Revision 1.9: download - view: text, annotated - select for diffs - revision graph
Mon Nov 21 22:19:32 2011 UTC (12 years, 5 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_8, rpl-4_1_7, rpl-4_1_6, rpl-4_1_5, rpl-4_1_4, HEAD
Cohérence

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

CVSweb interface <joel.bertrand@systella.fr>