LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine dtbrfs ( character UPLO, character TRANS, character DIAG, integer N, integer KD, integer NRHS, double precision, dimension( ldab, * ) AB, integer LDAB, double precision, dimension( ldb, * ) B, integer LDB, double precision, dimension( ldx, * ) X, integer LDX, double precision, dimension( * ) FERR, double precision, dimension( * ) BERR, double precision, dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO )

DTBRFS

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

Purpose:
``` DTBRFS provides error bounds and backward error estimates for the
solution to a system of linear equations with a triangular band
coefficient matrix.

The solution matrix X must be computed by DTBTRS or some other
means before entering this routine.  DTBRFS does not do iterative
refinement because doing so cannot improve the backward error.```
Parameters
 [in] UPLO ``` UPLO is CHARACTER*1 = 'U': A is upper triangular; = 'L': A is lower triangular.``` [in] TRANS ``` TRANS is CHARACTER*1 Specifies the form of the system of equations: = 'N': A * X = B (No transpose) = 'T': A**T * X = B (Transpose) = 'C': A**H * X = B (Conjugate transpose = Transpose)``` [in] DIAG ``` DIAG is CHARACTER*1 = 'N': A is non-unit triangular; = 'U': A is unit triangular.``` [in] N ``` N is INTEGER The order of the matrix A. N >= 0.``` [in] KD ``` KD is INTEGER The number of superdiagonals or subdiagonals of the triangular band matrix A. KD >= 0.``` [in] NRHS ``` NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.``` [in] AB ``` AB is DOUBLE PRECISION array, dimension (LDAB,N) The upper or lower triangular band matrix A, stored in the first kd+1 rows of the array. The j-th column of A is stored in the j-th column of the array AB as follows: if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd). If DIAG = 'U', the diagonal elements of A are not referenced and are assumed to be 1.``` [in] LDAB ``` LDAB is INTEGER The leading dimension of the array AB. LDAB >= KD+1.``` [in] B ``` B is DOUBLE PRECISION array, dimension (LDB,NRHS) The right hand side matrix B.``` [in] LDB ``` LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).``` [in] X ``` X is DOUBLE PRECISION array, dimension (LDX,NRHS) The solution matrix X.``` [in] LDX ``` LDX is INTEGER The leading dimension of the array X. LDX >= max(1,N).``` [out] FERR ``` FERR is DOUBLE PRECISION array, dimension (NRHS) The estimated forward error bound for each solution vector X(j) (the j-th column of the solution matrix X). If XTRUE is the true solution corresponding to X(j), FERR(j) is an estimated upper bound for the magnitude of the largest element in (X(j) - XTRUE) divided by the magnitude of the largest element in X(j). The estimate is as reliable as the estimate for RCOND, and is almost always a slight overestimate of the true error.``` [out] BERR ``` BERR is DOUBLE PRECISION array, dimension (NRHS) The componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).``` [out] WORK ` WORK is DOUBLE PRECISION array, dimension (3*N)` [out] IWORK ` IWORK is INTEGER array, dimension (N)` [out] INFO ``` INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value```
Date
November 2011

Definition at line 190 of file dtbrfs.f.

190 *
191 * -- LAPACK computational routine (version 3.4.0) --
192 * -- LAPACK is a software package provided by Univ. of Tennessee, --
193 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
194 * November 2011
195 *
196 * .. Scalar Arguments ..
197  CHARACTER diag, trans, uplo
198  INTEGER info, kd, ldab, ldb, ldx, n, nrhs
199 * ..
200 * .. Array Arguments ..
201  INTEGER iwork( * )
202  DOUBLE PRECISION ab( ldab, * ), b( ldb, * ), berr( * ),
203  \$ ferr( * ), work( * ), x( ldx, * )
204 * ..
205 *
206 * =====================================================================
207 *
208 * .. Parameters ..
209  DOUBLE PRECISION zero
210  parameter ( zero = 0.0d+0 )
211  DOUBLE PRECISION one
212  parameter ( one = 1.0d+0 )
213 * ..
214 * .. Local Scalars ..
215  LOGICAL notran, nounit, upper
216  CHARACTER transt
217  INTEGER i, j, k, kase, nz
218  DOUBLE PRECISION eps, lstres, s, safe1, safe2, safmin, xk
219 * ..
220 * .. Local Arrays ..
221  INTEGER isave( 3 )
222 * ..
223 * .. External Subroutines ..
224  EXTERNAL daxpy, dcopy, dlacn2, dtbmv, dtbsv, xerbla
225 * ..
226 * .. Intrinsic Functions ..
227  INTRINSIC abs, max, min
228 * ..
229 * .. External Functions ..
230  LOGICAL lsame
231  DOUBLE PRECISION dlamch
232  EXTERNAL lsame, dlamch
233 * ..
234 * .. Executable Statements ..
235 *
236 * Test the input parameters.
237 *
238  info = 0
239  upper = lsame( uplo, 'U' )
240  notran = lsame( trans, 'N' )
241  nounit = lsame( diag, 'N' )
242 *
243  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
244  info = -1
245  ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
246  \$ lsame( trans, 'C' ) ) THEN
247  info = -2
248  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
249  info = -3
250  ELSE IF( n.LT.0 ) THEN
251  info = -4
252  ELSE IF( kd.LT.0 ) THEN
253  info = -5
254  ELSE IF( nrhs.LT.0 ) THEN
255  info = -6
256  ELSE IF( ldab.LT.kd+1 ) THEN
257  info = -8
258  ELSE IF( ldb.LT.max( 1, n ) ) THEN
259  info = -10
260  ELSE IF( ldx.LT.max( 1, n ) ) THEN
261  info = -12
262  END IF
263  IF( info.NE.0 ) THEN
264  CALL xerbla( 'DTBRFS', -info )
265  RETURN
266  END IF
267 *
268 * Quick return if possible
269 *
270  IF( n.EQ.0 .OR. nrhs.EQ.0 ) THEN
271  DO 10 j = 1, nrhs
272  ferr( j ) = zero
273  berr( j ) = zero
274  10 CONTINUE
275  RETURN
276  END IF
277 *
278  IF( notran ) THEN
279  transt = 'T'
280  ELSE
281  transt = 'N'
282  END IF
283 *
284 * NZ = maximum number of nonzero elements in each row of A, plus 1
285 *
286  nz = kd + 2
287  eps = dlamch( 'Epsilon' )
288  safmin = dlamch( 'Safe minimum' )
289  safe1 = nz*safmin
290  safe2 = safe1 / eps
291 *
292 * Do for each right hand side
293 *
294  DO 250 j = 1, nrhs
295 *
296 * Compute residual R = B - op(A) * X,
297 * where op(A) = A or A**T, depending on TRANS.
298 *
299  CALL dcopy( n, x( 1, j ), 1, work( n+1 ), 1 )
300  CALL dtbmv( uplo, trans, diag, n, kd, ab, ldab, work( n+1 ),
301  \$ 1 )
302  CALL daxpy( n, -one, b( 1, j ), 1, work( n+1 ), 1 )
303 *
304 * Compute componentwise relative backward error from formula
305 *
306 * max(i) ( abs(R(i)) / ( abs(op(A))*abs(X) + abs(B) )(i) )
307 *
308 * where abs(Z) is the componentwise absolute value of the matrix
309 * or vector Z. If the i-th component of the denominator is less
310 * than SAFE2, then SAFE1 is added to the i-th components of the
311 * numerator and denominator before dividing.
312 *
313  DO 20 i = 1, n
314  work( i ) = abs( b( i, j ) )
315  20 CONTINUE
316 *
317  IF( notran ) THEN
318 *
319 * Compute abs(A)*abs(X) + abs(B).
320 *
321  IF( upper ) THEN
322  IF( nounit ) THEN
323  DO 40 k = 1, n
324  xk = abs( x( k, j ) )
325  DO 30 i = max( 1, k-kd ), k
326  work( i ) = work( i ) +
327  \$ abs( ab( kd+1+i-k, k ) )*xk
328  30 CONTINUE
329  40 CONTINUE
330  ELSE
331  DO 60 k = 1, n
332  xk = abs( x( k, j ) )
333  DO 50 i = max( 1, k-kd ), k - 1
334  work( i ) = work( i ) +
335  \$ abs( ab( kd+1+i-k, k ) )*xk
336  50 CONTINUE
337  work( k ) = work( k ) + xk
338  60 CONTINUE
339  END IF
340  ELSE
341  IF( nounit ) THEN
342  DO 80 k = 1, n
343  xk = abs( x( k, j ) )
344  DO 70 i = k, min( n, k+kd )
345  work( i ) = work( i ) + abs( ab( 1+i-k, k ) )*xk
346  70 CONTINUE
347  80 CONTINUE
348  ELSE
349  DO 100 k = 1, n
350  xk = abs( x( k, j ) )
351  DO 90 i = k + 1, min( n, k+kd )
352  work( i ) = work( i ) + abs( ab( 1+i-k, k ) )*xk
353  90 CONTINUE
354  work( k ) = work( k ) + xk
355  100 CONTINUE
356  END IF
357  END IF
358  ELSE
359 *
360 * Compute abs(A**T)*abs(X) + abs(B).
361 *
362  IF( upper ) THEN
363  IF( nounit ) THEN
364  DO 120 k = 1, n
365  s = zero
366  DO 110 i = max( 1, k-kd ), k
367  s = s + abs( ab( kd+1+i-k, k ) )*
368  \$ abs( x( i, j ) )
369  110 CONTINUE
370  work( k ) = work( k ) + s
371  120 CONTINUE
372  ELSE
373  DO 140 k = 1, n
374  s = abs( x( k, j ) )
375  DO 130 i = max( 1, k-kd ), k - 1
376  s = s + abs( ab( kd+1+i-k, k ) )*
377  \$ abs( x( i, j ) )
378  130 CONTINUE
379  work( k ) = work( k ) + s
380  140 CONTINUE
381  END IF
382  ELSE
383  IF( nounit ) THEN
384  DO 160 k = 1, n
385  s = zero
386  DO 150 i = k, min( n, k+kd )
387  s = s + abs( ab( 1+i-k, k ) )*abs( x( i, j ) )
388  150 CONTINUE
389  work( k ) = work( k ) + s
390  160 CONTINUE
391  ELSE
392  DO 180 k = 1, n
393  s = abs( x( k, j ) )
394  DO 170 i = k + 1, min( n, k+kd )
395  s = s + abs( ab( 1+i-k, k ) )*abs( x( i, j ) )
396  170 CONTINUE
397  work( k ) = work( k ) + s
398  180 CONTINUE
399  END IF
400  END IF
401  END IF
402  s = zero
403  DO 190 i = 1, n
404  IF( work( i ).GT.safe2 ) THEN
405  s = max( s, abs( work( n+i ) ) / work( i ) )
406  ELSE
407  s = max( s, ( abs( work( n+i ) )+safe1 ) /
408  \$ ( work( i )+safe1 ) )
409  END IF
410  190 CONTINUE
411  berr( j ) = s
412 *
413 * Bound error from formula
414 *
415 * norm(X - XTRUE) / norm(X) .le. FERR =
416 * norm( abs(inv(op(A)))*
417 * ( abs(R) + NZ*EPS*( abs(op(A))*abs(X)+abs(B) ))) / norm(X)
418 *
419 * where
420 * norm(Z) is the magnitude of the largest component of Z
421 * inv(op(A)) is the inverse of op(A)
422 * abs(Z) is the componentwise absolute value of the matrix or
423 * vector Z
424 * NZ is the maximum number of nonzeros in any row of A, plus 1
425 * EPS is machine epsilon
426 *
427 * The i-th component of abs(R)+NZ*EPS*(abs(op(A))*abs(X)+abs(B))
428 * is incremented by SAFE1 if the i-th component of
429 * abs(op(A))*abs(X) + abs(B) is less than SAFE2.
430 *
431 * Use DLACN2 to estimate the infinity-norm of the matrix
432 * inv(op(A)) * diag(W),
433 * where W = abs(R) + NZ*EPS*( abs(op(A))*abs(X)+abs(B) )))
434 *
435  DO 200 i = 1, n
436  IF( work( i ).GT.safe2 ) THEN
437  work( i ) = abs( work( n+i ) ) + nz*eps*work( i )
438  ELSE
439  work( i ) = abs( work( n+i ) ) + nz*eps*work( i ) + safe1
440  END IF
441  200 CONTINUE
442 *
443  kase = 0
444  210 CONTINUE
445  CALL dlacn2( n, work( 2*n+1 ), work( n+1 ), iwork, ferr( j ),
446  \$ kase, isave )
447  IF( kase.NE.0 ) THEN
448  IF( kase.EQ.1 ) THEN
449 *
450 * Multiply by diag(W)*inv(op(A)**T).
451 *
452  CALL dtbsv( uplo, transt, diag, n, kd, ab, ldab,
453  \$ work( n+1 ), 1 )
454  DO 220 i = 1, n
455  work( n+i ) = work( i )*work( n+i )
456  220 CONTINUE
457  ELSE
458 *
459 * Multiply by inv(op(A))*diag(W).
460 *
461  DO 230 i = 1, n
462  work( n+i ) = work( i )*work( n+i )
463  230 CONTINUE
464  CALL dtbsv( uplo, trans, diag, n, kd, ab, ldab,
465  \$ work( n+1 ), 1 )
466  END IF
467  GO TO 210
468  END IF
469 *
470 * Normalize error.
471 *
472  lstres = zero
473  DO 240 i = 1, n
474  lstres = max( lstres, abs( x( i, j ) ) )
475  240 CONTINUE
476  IF( lstres.NE.zero )
477  \$ ferr( j ) = ferr( j ) / lstres
478 *
479  250 CONTINUE
480 *
481  RETURN
482 *
483 * End of DTBRFS
484 *
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:53
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dtbsv(UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX)
DTBSV
Definition: dtbsv.f:191
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:54
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dtbmv(UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX)
DTBMV
Definition: dtbmv.f:188
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dlacn2(N, V, X, ISGN, EST, KASE, ISAVE)
DLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: dlacn2.f:138

Here is the call graph for this function:

Here is the caller graph for this function: