LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ slantb()

 real function slantb ( character NORM, character UPLO, character DIAG, integer N, integer K, real, dimension( ldab, * ) AB, integer LDAB, real, dimension( * ) WORK )

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

Purpose:
SLANTB  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 triangular band matrix A,  with ( k + 1 ) diagonals.
Returns
SLANTB
SLANTB = ( 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 SLANTB as described above. [in] UPLO UPLO is CHARACTER*1 Specifies whether the matrix A is upper or lower triangular. = 'U': Upper triangular = 'L': Lower triangular [in] DIAG DIAG is CHARACTER*1 Specifies whether or not the matrix A is unit triangular. = 'N': Non-unit triangular = 'U': Unit triangular [in] N N is INTEGER The order of the matrix A. N >= 0. When N = 0, SLANTB is set to zero. [in] K K is INTEGER The number of super-diagonals of the matrix A if UPLO = 'U', or the number of sub-diagonals of the matrix A if UPLO = 'L'. K >= 0. [in] AB AB is REAL array, dimension (LDAB,N) The upper or lower triangular 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). Note that when DIAG = 'U', the elements of the array AB corresponding to the diagonal elements of the matrix A are not referenced, but are assumed to be one. [in] LDAB LDAB is INTEGER The leading dimension of the array AB. LDAB >= K+1. [out] WORK WORK is REAL array, dimension (MAX(1,LWORK)), where LWORK >= N when NORM = 'I'; otherwise, WORK is not referenced.

Definition at line 138 of file slantb.f.

140*
141* -- LAPACK auxiliary routine --
142* -- LAPACK is a software package provided by Univ. of Tennessee, --
143* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
144*
145* .. Scalar Arguments ..
146 CHARACTER DIAG, NORM, UPLO
147 INTEGER K, LDAB, N
148* ..
149* .. Array Arguments ..
150 REAL AB( LDAB, * ), WORK( * )
151* ..
152*
153* =====================================================================
154*
155* .. Parameters ..
156 REAL ONE, ZERO
157 parameter( one = 1.0e+0, zero = 0.0e+0 )
158* ..
159* .. Local Scalars ..
160 LOGICAL UDIAG
161 INTEGER I, J, L
162 REAL SCALE, SUM, VALUE
163* ..
164* .. External Subroutines ..
165 EXTERNAL slassq
166* ..
167* .. External Functions ..
168 LOGICAL LSAME, SISNAN
169 EXTERNAL lsame, sisnan
170* ..
171* .. Intrinsic Functions ..
172 INTRINSIC abs, max, min, sqrt
173* ..
174* .. Executable Statements ..
175*
176 IF( n.EQ.0 ) THEN
177 VALUE = zero
178 ELSE IF( lsame( norm, 'M' ) ) THEN
179*
180* Find max(abs(A(i,j))).
181*
182 IF( lsame( diag, 'U' ) ) THEN
183 VALUE = one
184 IF( lsame( uplo, 'U' ) ) THEN
185 DO 20 j = 1, n
186 DO 10 i = max( k+2-j, 1 ), k
187 sum = abs( ab( i, j ) )
188 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
189 10 CONTINUE
190 20 CONTINUE
191 ELSE
192 DO 40 j = 1, n
193 DO 30 i = 2, min( n+1-j, k+1 )
194 sum = abs( ab( i, j ) )
195 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
196 30 CONTINUE
197 40 CONTINUE
198 END IF
199 ELSE
200 VALUE = zero
201 IF( lsame( uplo, 'U' ) ) THEN
202 DO 60 j = 1, n
203 DO 50 i = max( k+2-j, 1 ), k + 1
204 sum = abs( ab( i, j ) )
205 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
206 50 CONTINUE
207 60 CONTINUE
208 ELSE
209 DO 80 j = 1, n
210 DO 70 i = 1, min( n+1-j, k+1 )
211 sum = abs( ab( i, j ) )
212 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
213 70 CONTINUE
214 80 CONTINUE
215 END IF
216 END IF
217 ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
218*
219* Find norm1(A).
220*
221 VALUE = zero
222 udiag = lsame( diag, 'U' )
223 IF( lsame( uplo, 'U' ) ) THEN
224 DO 110 j = 1, n
225 IF( udiag ) THEN
226 sum = one
227 DO 90 i = max( k+2-j, 1 ), k
228 sum = sum + abs( ab( i, j ) )
229 90 CONTINUE
230 ELSE
231 sum = zero
232 DO 100 i = max( k+2-j, 1 ), k + 1
233 sum = sum + abs( ab( i, j ) )
234 100 CONTINUE
235 END IF
236 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
237 110 CONTINUE
238 ELSE
239 DO 140 j = 1, n
240 IF( udiag ) THEN
241 sum = one
242 DO 120 i = 2, min( n+1-j, k+1 )
243 sum = sum + abs( ab( i, j ) )
244 120 CONTINUE
245 ELSE
246 sum = zero
247 DO 130 i = 1, min( n+1-j, k+1 )
248 sum = sum + abs( ab( i, j ) )
249 130 CONTINUE
250 END IF
251 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
252 140 CONTINUE
253 END IF
254 ELSE IF( lsame( norm, 'I' ) ) THEN
255*
256* Find normI(A).
257*
258 VALUE = zero
259 IF( lsame( uplo, 'U' ) ) THEN
260 IF( lsame( diag, 'U' ) ) THEN
261 DO 150 i = 1, n
262 work( i ) = one
263 150 CONTINUE
264 DO 170 j = 1, n
265 l = k + 1 - j
266 DO 160 i = max( 1, j-k ), j - 1
267 work( i ) = work( i ) + abs( ab( l+i, j ) )
268 160 CONTINUE
269 170 CONTINUE
270 ELSE
271 DO 180 i = 1, n
272 work( i ) = zero
273 180 CONTINUE
274 DO 200 j = 1, n
275 l = k + 1 - j
276 DO 190 i = max( 1, j-k ), j
277 work( i ) = work( i ) + abs( ab( l+i, j ) )
278 190 CONTINUE
279 200 CONTINUE
280 END IF
281 ELSE
282 IF( lsame( diag, 'U' ) ) THEN
283 DO 210 i = 1, n
284 work( i ) = one
285 210 CONTINUE
286 DO 230 j = 1, n
287 l = 1 - j
288 DO 220 i = j + 1, min( n, j+k )
289 work( i ) = work( i ) + abs( ab( l+i, j ) )
290 220 CONTINUE
291 230 CONTINUE
292 ELSE
293 DO 240 i = 1, n
294 work( i ) = zero
295 240 CONTINUE
296 DO 260 j = 1, n
297 l = 1 - j
298 DO 250 i = j, min( n, j+k )
299 work( i ) = work( i ) + abs( ab( l+i, j ) )
300 250 CONTINUE
301 260 CONTINUE
302 END IF
303 END IF
304 DO 270 i = 1, n
305 sum = work( i )
306 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
307 270 CONTINUE
308 ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
309*
310* Find normF(A).
311*
312 IF( lsame( uplo, 'U' ) ) THEN
313 IF( lsame( diag, 'U' ) ) THEN
314 scale = one
315 sum = n
316 IF( k.GT.0 ) THEN
317 DO 280 j = 2, n
318 CALL slassq( min( j-1, k ),
319 \$ ab( max( k+2-j, 1 ), j ), 1, scale,
320 \$ sum )
321 280 CONTINUE
322 END IF
323 ELSE
324 scale = zero
325 sum = one
326 DO 290 j = 1, n
327 CALL slassq( min( j, k+1 ), ab( max( k+2-j, 1 ), j ),
328 \$ 1, scale, sum )
329 290 CONTINUE
330 END IF
331 ELSE
332 IF( lsame( diag, 'U' ) ) THEN
333 scale = one
334 sum = n
335 IF( k.GT.0 ) THEN
336 DO 300 j = 1, n - 1
337 CALL slassq( min( n-j, k ), ab( 2, j ), 1, scale,
338 \$ sum )
339 300 CONTINUE
340 END IF
341 ELSE
342 scale = zero
343 sum = one
344 DO 310 j = 1, n
345 CALL slassq( min( n-j+1, k+1 ), ab( 1, j ), 1, scale,
346 \$ sum )
347 310 CONTINUE
348 END IF
349 END IF
350 VALUE = scale*sqrt( sum )
351 END IF
352*
353 slantb = VALUE
354 RETURN
355*
356* End of SLANTB
357*
subroutine slassq(n, x, incx, scl, sumsq)
SLASSQ updates a sum of squares represented in scaled form.
Definition: slassq.f90:137
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:59
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
real function slantb(NORM, UPLO, DIAG, N, K, AB, LDAB, WORK)
SLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: slantb.f:140
Here is the call graph for this function:
Here is the caller graph for this function: