LAPACK 3.3.1
Linear Algebra PACKage

dlansb.f

Go to the documentation of this file.
00001       DOUBLE PRECISION FUNCTION DLANSB( NORM, UPLO, N, K, AB, LDAB,
00002      $                 WORK )
00003 *
00004 *  -- LAPACK auxiliary routine (version 3.2) --
00005 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00006 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00007 *     November 2006
00008 *
00009 *     .. Scalar Arguments ..
00010       CHARACTER          NORM, UPLO
00011       INTEGER            K, LDAB, N
00012 *     ..
00013 *     .. Array Arguments ..
00014       DOUBLE PRECISION   AB( LDAB, * ), WORK( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  DLANSB  returns the value of the one norm,  or the Frobenius norm, or
00021 *  the  infinity norm,  or the element of  largest absolute value  of an
00022 *  n by n symmetric band matrix A,  with k super-diagonals.
00023 *
00024 *  Description
00025 *  ===========
00026 *
00027 *  DLANSB returns the value
00028 *
00029 *     DLANSB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
00030 *              (
00031 *              ( norm1(A),         NORM = '1', 'O' or 'o'
00032 *              (
00033 *              ( normI(A),         NORM = 'I' or 'i'
00034 *              (
00035 *              ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
00036 *
00037 *  where  norm1  denotes the  one norm of a matrix (maximum column sum),
00038 *  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
00039 *  normF  denotes the  Frobenius norm of a matrix (square root of sum of
00040 *  squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
00041 *
00042 *  Arguments
00043 *  =========
00044 *
00045 *  NORM    (input) CHARACTER*1
00046 *          Specifies the value to be returned in DLANSB as described
00047 *          above.
00048 *
00049 *  UPLO    (input) CHARACTER*1
00050 *          Specifies whether the upper or lower triangular part of the
00051 *          band matrix A is supplied.
00052 *          = 'U':  Upper triangular part is supplied
00053 *          = 'L':  Lower triangular part is supplied
00054 *
00055 *  N       (input) INTEGER
00056 *          The order of the matrix A.  N >= 0.  When N = 0, DLANSB is
00057 *          set to zero.
00058 *
00059 *  K       (input) INTEGER
00060 *          The number of super-diagonals or sub-diagonals of the
00061 *          band matrix A.  K >= 0.
00062 *
00063 *  AB      (input) DOUBLE PRECISION array, dimension (LDAB,N)
00064 *          The upper or lower triangle of the symmetric band matrix A,
00065 *          stored in the first K+1 rows of AB.  The j-th column of A is
00066 *          stored in the j-th column of the array AB as follows:
00067 *          if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
00068 *          if UPLO = 'L', AB(1+i-j,j)   = A(i,j) for j<=i<=min(n,j+k).
00069 *
00070 *  LDAB    (input) INTEGER
00071 *          The leading dimension of the array AB.  LDAB >= K+1.
00072 *
00073 *  WORK    (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
00074 *          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
00075 *          WORK is not referenced.
00076 *
00077 * =====================================================================
00078 *
00079 *     .. Parameters ..
00080       DOUBLE PRECISION   ONE, ZERO
00081       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00082 *     ..
00083 *     .. Local Scalars ..
00084       INTEGER            I, J, L
00085       DOUBLE PRECISION   ABSA, SCALE, SUM, VALUE
00086 *     ..
00087 *     .. External Subroutines ..
00088       EXTERNAL           DLASSQ
00089 *     ..
00090 *     .. External Functions ..
00091       LOGICAL            LSAME
00092       EXTERNAL           LSAME
00093 *     ..
00094 *     .. Intrinsic Functions ..
00095       INTRINSIC          ABS, MAX, MIN, SQRT
00096 *     ..
00097 *     .. Executable Statements ..
00098 *
00099       IF( N.EQ.0 ) THEN
00100          VALUE = ZERO
00101       ELSE IF( LSAME( NORM, 'M' ) ) THEN
00102 *
00103 *        Find max(abs(A(i,j))).
00104 *
00105          VALUE = ZERO
00106          IF( LSAME( UPLO, 'U' ) ) THEN
00107             DO 20 J = 1, N
00108                DO 10 I = MAX( K+2-J, 1 ), K + 1
00109                   VALUE = MAX( VALUE, ABS( AB( I, J ) ) )
00110    10          CONTINUE
00111    20       CONTINUE
00112          ELSE
00113             DO 40 J = 1, N
00114                DO 30 I = 1, MIN( N+1-J, K+1 )
00115                   VALUE = MAX( VALUE, ABS( AB( I, J ) ) )
00116    30          CONTINUE
00117    40       CONTINUE
00118          END IF
00119       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
00120      $         ( NORM.EQ.'1' ) ) THEN
00121 *
00122 *        Find normI(A) ( = norm1(A), since A is symmetric).
00123 *
00124          VALUE = ZERO
00125          IF( LSAME( UPLO, 'U' ) ) THEN
00126             DO 60 J = 1, N
00127                SUM = ZERO
00128                L = K + 1 - J
00129                DO 50 I = MAX( 1, J-K ), J - 1
00130                   ABSA = ABS( AB( L+I, J ) )
00131                   SUM = SUM + ABSA
00132                   WORK( I ) = WORK( I ) + ABSA
00133    50          CONTINUE
00134                WORK( J ) = SUM + ABS( AB( K+1, J ) )
00135    60       CONTINUE
00136             DO 70 I = 1, N
00137                VALUE = MAX( VALUE, WORK( I ) )
00138    70       CONTINUE
00139          ELSE
00140             DO 80 I = 1, N
00141                WORK( I ) = ZERO
00142    80       CONTINUE
00143             DO 100 J = 1, N
00144                SUM = WORK( J ) + ABS( AB( 1, J ) )
00145                L = 1 - J
00146                DO 90 I = J + 1, MIN( N, J+K )
00147                   ABSA = ABS( AB( L+I, J ) )
00148                   SUM = SUM + ABSA
00149                   WORK( I ) = WORK( I ) + ABSA
00150    90          CONTINUE
00151                VALUE = MAX( VALUE, SUM )
00152   100       CONTINUE
00153          END IF
00154       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
00155 *
00156 *        Find normF(A).
00157 *
00158          SCALE = ZERO
00159          SUM = ONE
00160          IF( K.GT.0 ) THEN
00161             IF( LSAME( UPLO, 'U' ) ) THEN
00162                DO 110 J = 2, N
00163                   CALL DLASSQ( MIN( J-1, K ), AB( MAX( K+2-J, 1 ), J ),
00164      $                         1, SCALE, SUM )
00165   110          CONTINUE
00166                L = K + 1
00167             ELSE
00168                DO 120 J = 1, N - 1
00169                   CALL DLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
00170      $                         SUM )
00171   120          CONTINUE
00172                L = 1
00173             END IF
00174             SUM = 2*SUM
00175          ELSE
00176             L = 1
00177          END IF
00178          CALL DLASSQ( N, AB( L, 1 ), LDAB, SCALE, SUM )
00179          VALUE = SCALE*SQRT( SUM )
00180       END IF
00181 *
00182       DLANSB = VALUE
00183       RETURN
00184 *
00185 *     End of DLANSB
00186 *
00187       END
 All Files Functions