LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ dlansb()

double precision function dlansb ( character  NORM,
character  UPLO,
integer  N,
integer  K,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( * )  WORK 
)

DLANSB 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.

Download DLANSB + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DLANSB  returns the value of the one norm,  or the Frobenius norm, or
 the  infinity norm,  or the element of  largest absolute value  of an
 n by n symmetric band matrix A,  with k super-diagonals.
Returns
DLANSB
    DLANSB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
             (
             ( norm1(A),         NORM = '1', 'O' or 'o'
             (
             ( normI(A),         NORM = 'I' or 'i'
             (
             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'

 where  norm1  denotes the  one norm of a matrix (maximum column sum),
 normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
 normF  denotes the  Frobenius norm of a matrix (square root of sum of
 squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
Parameters
[in]NORM
          NORM is CHARACTER*1
          Specifies the value to be returned in DLANSB as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          band matrix A is supplied.
          = 'U':  Upper triangular part is supplied
          = 'L':  Lower triangular part is supplied
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, DLANSB is
          set to zero.
[in]K
          K is INTEGER
          The number of super-diagonals or sub-diagonals of the
          band matrix A.  K >= 0.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          The upper or lower triangle of the symmetric band matrix A,
          stored in the first K+1 rows of AB.  The j-th column of A is
          stored in the j-th column of the array AB as follows:
          if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
          if UPLO = 'L', AB(1+i-j,j)   = A(i,j) for j<=i<=min(n,j+k).
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= K+1.
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
          WORK is not referenced.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 131 of file dlansb.f.

131 *
132 * -- LAPACK auxiliary routine (version 3.7.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 * December 2016
136 *
137  IMPLICIT NONE
138 * .. Scalar Arguments ..
139  CHARACTER NORM, UPLO
140  INTEGER K, LDAB, N
141 * ..
142 * .. Array Arguments ..
143  DOUBLE PRECISION AB( LDAB, * ), WORK( * )
144 * ..
145 *
146 * =====================================================================
147 *
148 * .. Parameters ..
149  DOUBLE PRECISION ONE, ZERO
150  parameter( one = 1.0d+0, zero = 0.0d+0 )
151 * ..
152 * .. Local Scalars ..
153  INTEGER I, J, L
154  DOUBLE PRECISION ABSA, SUM, VALUE
155 * ..
156 * .. Local Arrays ..
157  DOUBLE PRECISION SSQ( 2 ), COLSSQ( 2 )
158 * ..
159 * .. External Functions ..
160  LOGICAL LSAME, DISNAN
161  EXTERNAL lsame, disnan
162 * ..
163 * .. External Subroutines ..
164  EXTERNAL dlassq, dcombssq
165 * ..
166 * .. Intrinsic Functions ..
167  INTRINSIC abs, max, min, sqrt
168 * ..
169 * .. Executable Statements ..
170 *
171  IF( n.EQ.0 ) THEN
172  VALUE = zero
173  ELSE IF( lsame( norm, 'M' ) ) THEN
174 *
175 * Find max(abs(A(i,j))).
176 *
177  VALUE = zero
178  IF( lsame( uplo, 'U' ) ) THEN
179  DO 20 j = 1, n
180  DO 10 i = max( k+2-j, 1 ), k + 1
181  sum = abs( ab( i, j ) )
182  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
183  10 CONTINUE
184  20 CONTINUE
185  ELSE
186  DO 40 j = 1, n
187  DO 30 i = 1, min( n+1-j, k+1 )
188  sum = abs( ab( i, j ) )
189  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
190  30 CONTINUE
191  40 CONTINUE
192  END IF
193  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
194  $ ( norm.EQ.'1' ) ) THEN
195 *
196 * Find normI(A) ( = norm1(A), since A is symmetric).
197 *
198  VALUE = zero
199  IF( lsame( uplo, 'U' ) ) THEN
200  DO 60 j = 1, n
201  sum = zero
202  l = k + 1 - j
203  DO 50 i = max( 1, j-k ), j - 1
204  absa = abs( ab( l+i, j ) )
205  sum = sum + absa
206  work( i ) = work( i ) + absa
207  50 CONTINUE
208  work( j ) = sum + abs( ab( k+1, j ) )
209  60 CONTINUE
210  DO 70 i = 1, n
211  sum = work( i )
212  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
213  70 CONTINUE
214  ELSE
215  DO 80 i = 1, n
216  work( i ) = zero
217  80 CONTINUE
218  DO 100 j = 1, n
219  sum = work( j ) + abs( ab( 1, j ) )
220  l = 1 - j
221  DO 90 i = j + 1, min( n, j+k )
222  absa = abs( ab( l+i, j ) )
223  sum = sum + absa
224  work( i ) = work( i ) + absa
225  90 CONTINUE
226  IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
227  100 CONTINUE
228  END IF
229  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
230 *
231 * Find normF(A).
232 * SSQ(1) is scale
233 * SSQ(2) is sum-of-squares
234 * For better accuracy, sum each column separately.
235 *
236  ssq( 1 ) = zero
237  ssq( 2 ) = one
238 *
239 * Sum off-diagonals
240 *
241  IF( k.GT.0 ) THEN
242  IF( lsame( uplo, 'U' ) ) THEN
243  DO 110 j = 2, n
244  colssq( 1 ) = zero
245  colssq( 2 ) = one
246  CALL dlassq( min( j-1, k ), ab( max( k+2-j, 1 ), j ),
247  $ 1, colssq( 1 ), colssq( 2 ) )
248  CALL dcombssq( ssq, colssq )
249  110 CONTINUE
250  l = k + 1
251  ELSE
252  DO 120 j = 1, n - 1
253  colssq( 1 ) = zero
254  colssq( 2 ) = one
255  CALL dlassq( min( n-j, k ), ab( 2, j ), 1,
256  $ colssq( 1 ), colssq( 2 ) )
257  CALL dcombssq( ssq, colssq )
258  120 CONTINUE
259  l = 1
260  END IF
261  ssq( 2 ) = 2*ssq( 2 )
262  ELSE
263  l = 1
264  END IF
265 *
266 * Sum diagonal
267 *
268  colssq( 1 ) = zero
269  colssq( 2 ) = one
270  CALL dlassq( n, ab( l, 1 ), ldab, colssq( 1 ), colssq( 2 ) )
271  CALL dcombssq( ssq, colssq )
272  VALUE = ssq( 1 )*sqrt( ssq( 2 ) )
273  END IF
274 *
275  dlansb = VALUE
276  RETURN
277 *
278 * End of DLANSB
279 *
Here is the call graph for this function:
dlansb
double precision function dlansb(NORM, UPLO, N, K, AB, LDAB, WORK)
DLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: dlansb.f:131
disnan
logical function disnan(DIN)
DISNAN tests input for NaN.
Definition: disnan.f:61
lsame
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
dlassq
subroutine dlassq(N, X, INCX, SCALE, SUMSQ)
DLASSQ updates a sum of squares represented in scaled form.
Definition: dlassq.f:105
dcombssq
subroutine dcombssq(V1, V2)
DCOMBSSQ adds two scaled sum of squares quantities.
Definition: dcombssq.f:62