140 DOUBLE PRECISION FUNCTION dlantb( NORM, UPLO, DIAG, N, K, AB,
149 CHARACTER DIAG, NORM, UPLO
153 DOUBLE PRECISION AB( ldab, * ), WORK( * )
159 DOUBLE PRECISION ONE, ZERO
160 parameter ( one = 1.0d+0, zero = 0.0d+0 )
165 DOUBLE PRECISION SCALE, SUM, VALUE
171 LOGICAL LSAME, DISNAN
172 EXTERNAL lsame, disnan
175 INTRINSIC abs, max, min, sqrt
181 ELSE IF( lsame( norm,
'M' ) )
THEN
185 IF( lsame( diag,
'U' ) )
THEN
187 IF( lsame( uplo,
'U' ) )
THEN
189 DO 10 i = max( k+2-j, 1 ), k
190 sum = abs( ab( i, j ) )
191 IF(
VALUE .LT. sum .OR. disnan( sum ) )
VALUE = sum
196 DO 30 i = 2, min( n+1-j, k+1 )
197 sum = abs( ab( i, j ) )
198 IF(
VALUE .LT. sum .OR. disnan( sum ) )
VALUE = sum
204 IF( lsame( uplo,
'U' ) )
THEN
206 DO 50 i = max( k+2-j, 1 ), k + 1
207 sum = abs( ab( i, j ) )
208 IF(
VALUE .LT. sum .OR. disnan( sum ) )
VALUE = sum
213 DO 70 i = 1, min( n+1-j, k+1 )
214 sum = abs( ab( i, j ) )
215 IF(
VALUE .LT. sum .OR. disnan( sum ) )
VALUE = sum
220 ELSE IF( ( lsame( norm,
'O' ) ) .OR. ( norm.EQ.
'1' ) )
THEN
225 udiag = lsame( diag,
'U' )
226 IF( lsame( uplo,
'U' ) )
THEN
230 DO 90 i = max( k+2-j, 1 ), k
231 sum = sum + abs( ab( i, j ) )
235 DO 100 i = max( k+2-j, 1 ), k + 1
236 sum = sum + abs( ab( i, j ) )
239 IF(
VALUE .LT. sum .OR. disnan( sum ) )
VALUE = sum
245 DO 120 i = 2, min( n+1-j, k+1 )
246 sum = sum + abs( ab( i, j ) )
250 DO 130 i = 1, min( n+1-j, k+1 )
251 sum = sum + abs( ab( i, j ) )
254 IF(
VALUE .LT. sum .OR. disnan( sum ) )
VALUE = sum
257 ELSE IF( lsame( norm,
'I' ) )
THEN
262 IF( lsame( uplo,
'U' ) )
THEN
263 IF( lsame( diag,
'U' ) )
THEN
269 DO 160 i = max( 1, j-k ), j - 1
270 work( i ) = work( i ) + abs( ab( l+i, j ) )
279 DO 190 i = max( 1, j-k ), j
280 work( i ) = work( i ) + abs( ab( l+i, j ) )
285 IF( lsame( diag,
'U' ) )
THEN
291 DO 220 i = j + 1, min( n, j+k )
292 work( i ) = work( i ) + abs( ab( l+i, j ) )
301 DO 250 i = j, min( n, j+k )
302 work( i ) = work( i ) + abs( ab( l+i, j ) )
309 IF(
VALUE .LT. sum .OR. disnan( sum ) )
VALUE = sum
311 ELSE IF( ( lsame( norm,
'F' ) ) .OR. ( lsame( norm,
'E' ) ) )
THEN
315 IF( lsame( uplo,
'U' ) )
THEN
316 IF( lsame( diag,
'U' ) )
THEN
321 CALL dlassq( min( j-1, k ),
322 $ ab( max( k+2-j, 1 ), j ), 1, scale,
330 CALL dlassq( min( j, k+1 ), ab( max( k+2-j, 1 ), j ),
335 IF( lsame( diag,
'U' ) )
THEN
340 CALL dlassq( min( n-j, k ), ab( 2, j ), 1, scale,
348 CALL dlassq( min( n-j+1, k+1 ), ab( 1, j ), 1, scale,
353 VALUE = scale*sqrt( sum )
double precision function dlantb(NORM, UPLO, DIAG, N, K, AB, LDAB, WORK)
DLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular band matrix.
subroutine dlassq(N, X, INCX, SCALE, SUMSQ)
DLASSQ updates a sum of squares represented in scaled form.