LAPACK  3.6.0
LAPACK: Linear Algebra PACKage
Collaboration diagram for double:

Functions

subroutine dgbbrd (VECT, M, N, NCC, KL, KU, AB, LDAB, D, E, Q, LDQ, PT, LDPT, C, LDC, WORK, INFO)
 DGBBRD More...
 
subroutine dgbcon (NORM, N, KL, KU, AB, LDAB, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
 DGBCON More...
 
subroutine dgbequ (M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX, INFO)
 DGBEQU More...
 
subroutine dgbequb (M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX, INFO)
 DGBEQUB More...
 
subroutine dgbrfs (TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO)
 DGBRFS More...
 
subroutine dgbrfsx (TRANS, EQUED, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, R, C, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO)
 DGBRFSX More...
 
subroutine dgbtf2 (M, N, KL, KU, AB, LDAB, IPIV, INFO)
 DGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algorithm. More...
 
subroutine dgbtrf (M, N, KL, KU, AB, LDAB, IPIV, INFO)
 DGBTRF More...
 
subroutine dgbtrs (TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
 DGBTRS More...
 
subroutine dggbak (JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V, LDV, INFO)
 DGGBAK More...
 
subroutine dggbal (JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
 DGGBAL More...
 
subroutine dla_gbamv (TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X, INCX, BETA, Y, INCY)
 DLA_GBAMV performs a matrix-vector operation to calculate error bounds. More...
 
double precision function dla_gbrcond (TRANS, N, KL, KU, AB, LDAB, AFB, LDAFB, IPIV, CMODE, C, INFO, WORK, IWORK)
 DLA_GBRCOND estimates the Skeel condition number for a general banded matrix. More...
 
subroutine dla_gbrfsx_extended (PREC_TYPE, TRANS_TYPE, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT, N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP, RES, AYB, DY, Y_TAIL, RCOND, ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)
 DLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution. More...
 
double precision function dla_gbrpvgrw (N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB)
 DLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix. More...
 
subroutine dorgbr (VECT, M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
 DORGBR More...
 

Detailed Description

This is the group of double computational functions for GB matrices

Function Documentation

subroutine dgbbrd ( character  VECT,
integer  M,
integer  N,
integer  NCC,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( * )  D,
double precision, dimension( * )  E,
double precision, dimension( ldq, * )  Q,
integer  LDQ,
double precision, dimension( ldpt, * )  PT,
integer  LDPT,
double precision, dimension( ldc, * )  C,
integer  LDC,
double precision, dimension( * )  WORK,
integer  INFO 
)

DGBBRD

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

Purpose:
 DGBBRD reduces a real general m-by-n band matrix A to upper
 bidiagonal form B by an orthogonal transformation: Q**T * A * P = B.

 The routine computes B, and optionally forms Q or P**T, or computes
 Q**T*C for a given matrix C.
Parameters
[in]VECT
          VECT is CHARACTER*1
          Specifies whether or not the matrices Q and P**T are to be
          formed.
          = 'N': do not form Q or P**T;
          = 'Q': form Q only;
          = 'P': form P**T only;
          = 'B': form both.
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.
[in]NCC
          NCC is INTEGER
          The number of columns of the matrix C.  NCC >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals of the matrix A. KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals of the matrix A. KU >= 0.
[in,out]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          On entry, the m-by-n band matrix A, stored in rows 1 to
          KL+KU+1. The j-th column of A is stored in the j-th column of
          the array AB as follows:
          AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl).
          On exit, A is overwritten by values generated during the
          reduction.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array A. LDAB >= KL+KU+1.
[out]D
          D is DOUBLE PRECISION array, dimension (min(M,N))
          The diagonal elements of the bidiagonal matrix B.
[out]E
          E is DOUBLE PRECISION array, dimension (min(M,N)-1)
          The superdiagonal elements of the bidiagonal matrix B.
[out]Q
          Q is DOUBLE PRECISION array, dimension (LDQ,M)
          If VECT = 'Q' or 'B', the m-by-m orthogonal matrix Q.
          If VECT = 'N' or 'P', the array Q is not referenced.
[in]LDQ
          LDQ is INTEGER
          The leading dimension of the array Q.
          LDQ >= max(1,M) if VECT = 'Q' or 'B'; LDQ >= 1 otherwise.
[out]PT
          PT is DOUBLE PRECISION array, dimension (LDPT,N)
          If VECT = 'P' or 'B', the n-by-n orthogonal matrix P'.
          If VECT = 'N' or 'Q', the array PT is not referenced.
[in]LDPT
          LDPT is INTEGER
          The leading dimension of the array PT.
          LDPT >= max(1,N) if VECT = 'P' or 'B'; LDPT >= 1 otherwise.
[in,out]C
          C is DOUBLE PRECISION array, dimension (LDC,NCC)
          On entry, an m-by-ncc matrix C.
          On exit, C is overwritten by Q**T*C.
          C is not referenced if NCC = 0.
[in]LDC
          LDC is INTEGER
          The leading dimension of the array C.
          LDC >= max(1,M) if NCC > 0; LDC >= 1 if NCC = 0.
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (2*max(M,N))
[out]INFO
          INFO is INTEGER
          = 0:  successful exit.
          < 0:  if INFO = -i, the i-th argument had an illegal value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 189 of file dgbbrd.f.

189 *
190 * -- LAPACK computational routine (version 3.4.0) --
191 * -- LAPACK is a software package provided by Univ. of Tennessee, --
192 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
193 * November 2011
194 *
195 * .. Scalar Arguments ..
196  CHARACTER vect
197  INTEGER info, kl, ku, ldab, ldc, ldpt, ldq, m, n, ncc
198 * ..
199 * .. Array Arguments ..
200  DOUBLE PRECISION ab( ldab, * ), c( ldc, * ), d( * ), e( * ),
201  $ pt( ldpt, * ), q( ldq, * ), work( * )
202 * ..
203 *
204 * =====================================================================
205 *
206 * .. Parameters ..
207  DOUBLE PRECISION zero, one
208  parameter( zero = 0.0d+0, one = 1.0d+0 )
209 * ..
210 * .. Local Scalars ..
211  LOGICAL wantb, wantc, wantpt, wantq
212  INTEGER i, inca, j, j1, j2, kb, kb1, kk, klm, klu1,
213  $ kun, l, minmn, ml, ml0, mn, mu, mu0, nr, nrt
214  DOUBLE PRECISION ra, rb, rc, rs
215 * ..
216 * .. External Subroutines ..
217  EXTERNAL dlargv, dlartg, dlartv, dlaset, drot, xerbla
218 * ..
219 * .. Intrinsic Functions ..
220  INTRINSIC max, min
221 * ..
222 * .. External Functions ..
223  LOGICAL lsame
224  EXTERNAL lsame
225 * ..
226 * .. Executable Statements ..
227 *
228 * Test the input parameters
229 *
230  wantb = lsame( vect, 'B' )
231  wantq = lsame( vect, 'Q' ) .OR. wantb
232  wantpt = lsame( vect, 'P' ) .OR. wantb
233  wantc = ncc.GT.0
234  klu1 = kl + ku + 1
235  info = 0
236  IF( .NOT.wantq .AND. .NOT.wantpt .AND. .NOT.lsame( vect, 'N' ) )
237  $ THEN
238  info = -1
239  ELSE IF( m.LT.0 ) THEN
240  info = -2
241  ELSE IF( n.LT.0 ) THEN
242  info = -3
243  ELSE IF( ncc.LT.0 ) THEN
244  info = -4
245  ELSE IF( kl.LT.0 ) THEN
246  info = -5
247  ELSE IF( ku.LT.0 ) THEN
248  info = -6
249  ELSE IF( ldab.LT.klu1 ) THEN
250  info = -8
251  ELSE IF( ldq.LT.1 .OR. wantq .AND. ldq.LT.max( 1, m ) ) THEN
252  info = -12
253  ELSE IF( ldpt.LT.1 .OR. wantpt .AND. ldpt.LT.max( 1, n ) ) THEN
254  info = -14
255  ELSE IF( ldc.LT.1 .OR. wantc .AND. ldc.LT.max( 1, m ) ) THEN
256  info = -16
257  END IF
258  IF( info.NE.0 ) THEN
259  CALL xerbla( 'DGBBRD', -info )
260  RETURN
261  END IF
262 *
263 * Initialize Q and P**T to the unit matrix, if needed
264 *
265  IF( wantq )
266  $ CALL dlaset( 'Full', m, m, zero, one, q, ldq )
267  IF( wantpt )
268  $ CALL dlaset( 'Full', n, n, zero, one, pt, ldpt )
269 *
270 * Quick return if possible.
271 *
272  IF( m.EQ.0 .OR. n.EQ.0 )
273  $ RETURN
274 *
275  minmn = min( m, n )
276 *
277  IF( kl+ku.GT.1 ) THEN
278 *
279 * Reduce to upper bidiagonal form if KU > 0; if KU = 0, reduce
280 * first to lower bidiagonal form and then transform to upper
281 * bidiagonal
282 *
283  IF( ku.GT.0 ) THEN
284  ml0 = 1
285  mu0 = 2
286  ELSE
287  ml0 = 2
288  mu0 = 1
289  END IF
290 *
291 * Wherever possible, plane rotations are generated and applied in
292 * vector operations of length NR over the index set J1:J2:KLU1.
293 *
294 * The sines of the plane rotations are stored in WORK(1:max(m,n))
295 * and the cosines in WORK(max(m,n)+1:2*max(m,n)).
296 *
297  mn = max( m, n )
298  klm = min( m-1, kl )
299  kun = min( n-1, ku )
300  kb = klm + kun
301  kb1 = kb + 1
302  inca = kb1*ldab
303  nr = 0
304  j1 = klm + 2
305  j2 = 1 - kun
306 *
307  DO 90 i = 1, minmn
308 *
309 * Reduce i-th column and i-th row of matrix to bidiagonal form
310 *
311  ml = klm + 1
312  mu = kun + 1
313  DO 80 kk = 1, kb
314  j1 = j1 + kb
315  j2 = j2 + kb
316 *
317 * generate plane rotations to annihilate nonzero elements
318 * which have been created below the band
319 *
320  IF( nr.GT.0 )
321  $ CALL dlargv( nr, ab( klu1, j1-klm-1 ), inca,
322  $ work( j1 ), kb1, work( mn+j1 ), kb1 )
323 *
324 * apply plane rotations from the left
325 *
326  DO 10 l = 1, kb
327  IF( j2-klm+l-1.GT.n ) THEN
328  nrt = nr - 1
329  ELSE
330  nrt = nr
331  END IF
332  IF( nrt.GT.0 )
333  $ CALL dlartv( nrt, ab( klu1-l, j1-klm+l-1 ), inca,
334  $ ab( klu1-l+1, j1-klm+l-1 ), inca,
335  $ work( mn+j1 ), work( j1 ), kb1 )
336  10 CONTINUE
337 *
338  IF( ml.GT.ml0 ) THEN
339  IF( ml.LE.m-i+1 ) THEN
340 *
341 * generate plane rotation to annihilate a(i+ml-1,i)
342 * within the band, and apply rotation from the left
343 *
344  CALL dlartg( ab( ku+ml-1, i ), ab( ku+ml, i ),
345  $ work( mn+i+ml-1 ), work( i+ml-1 ),
346  $ ra )
347  ab( ku+ml-1, i ) = ra
348  IF( i.LT.n )
349  $ CALL drot( min( ku+ml-2, n-i ),
350  $ ab( ku+ml-2, i+1 ), ldab-1,
351  $ ab( ku+ml-1, i+1 ), ldab-1,
352  $ work( mn+i+ml-1 ), work( i+ml-1 ) )
353  END IF
354  nr = nr + 1
355  j1 = j1 - kb1
356  END IF
357 *
358  IF( wantq ) THEN
359 *
360 * accumulate product of plane rotations in Q
361 *
362  DO 20 j = j1, j2, kb1
363  CALL drot( m, q( 1, j-1 ), 1, q( 1, j ), 1,
364  $ work( mn+j ), work( j ) )
365  20 CONTINUE
366  END IF
367 *
368  IF( wantc ) THEN
369 *
370 * apply plane rotations to C
371 *
372  DO 30 j = j1, j2, kb1
373  CALL drot( ncc, c( j-1, 1 ), ldc, c( j, 1 ), ldc,
374  $ work( mn+j ), work( j ) )
375  30 CONTINUE
376  END IF
377 *
378  IF( j2+kun.GT.n ) THEN
379 *
380 * adjust J2 to keep within the bounds of the matrix
381 *
382  nr = nr - 1
383  j2 = j2 - kb1
384  END IF
385 *
386  DO 40 j = j1, j2, kb1
387 *
388 * create nonzero element a(j-1,j+ku) above the band
389 * and store it in WORK(n+1:2*n)
390 *
391  work( j+kun ) = work( j )*ab( 1, j+kun )
392  ab( 1, j+kun ) = work( mn+j )*ab( 1, j+kun )
393  40 CONTINUE
394 *
395 * generate plane rotations to annihilate nonzero elements
396 * which have been generated above the band
397 *
398  IF( nr.GT.0 )
399  $ CALL dlargv( nr, ab( 1, j1+kun-1 ), inca,
400  $ work( j1+kun ), kb1, work( mn+j1+kun ),
401  $ kb1 )
402 *
403 * apply plane rotations from the right
404 *
405  DO 50 l = 1, kb
406  IF( j2+l-1.GT.m ) THEN
407  nrt = nr - 1
408  ELSE
409  nrt = nr
410  END IF
411  IF( nrt.GT.0 )
412  $ CALL dlartv( nrt, ab( l+1, j1+kun-1 ), inca,
413  $ ab( l, j1+kun ), inca,
414  $ work( mn+j1+kun ), work( j1+kun ),
415  $ kb1 )
416  50 CONTINUE
417 *
418  IF( ml.EQ.ml0 .AND. mu.GT.mu0 ) THEN
419  IF( mu.LE.n-i+1 ) THEN
420 *
421 * generate plane rotation to annihilate a(i,i+mu-1)
422 * within the band, and apply rotation from the right
423 *
424  CALL dlartg( ab( ku-mu+3, i+mu-2 ),
425  $ ab( ku-mu+2, i+mu-1 ),
426  $ work( mn+i+mu-1 ), work( i+mu-1 ),
427  $ ra )
428  ab( ku-mu+3, i+mu-2 ) = ra
429  CALL drot( min( kl+mu-2, m-i ),
430  $ ab( ku-mu+4, i+mu-2 ), 1,
431  $ ab( ku-mu+3, i+mu-1 ), 1,
432  $ work( mn+i+mu-1 ), work( i+mu-1 ) )
433  END IF
434  nr = nr + 1
435  j1 = j1 - kb1
436  END IF
437 *
438  IF( wantpt ) THEN
439 *
440 * accumulate product of plane rotations in P**T
441 *
442  DO 60 j = j1, j2, kb1
443  CALL drot( n, pt( j+kun-1, 1 ), ldpt,
444  $ pt( j+kun, 1 ), ldpt, work( mn+j+kun ),
445  $ work( j+kun ) )
446  60 CONTINUE
447  END IF
448 *
449  IF( j2+kb.GT.m ) THEN
450 *
451 * adjust J2 to keep within the bounds of the matrix
452 *
453  nr = nr - 1
454  j2 = j2 - kb1
455  END IF
456 *
457  DO 70 j = j1, j2, kb1
458 *
459 * create nonzero element a(j+kl+ku,j+ku-1) below the
460 * band and store it in WORK(1:n)
461 *
462  work( j+kb ) = work( j+kun )*ab( klu1, j+kun )
463  ab( klu1, j+kun ) = work( mn+j+kun )*ab( klu1, j+kun )
464  70 CONTINUE
465 *
466  IF( ml.GT.ml0 ) THEN
467  ml = ml - 1
468  ELSE
469  mu = mu - 1
470  END IF
471  80 CONTINUE
472  90 CONTINUE
473  END IF
474 *
475  IF( ku.EQ.0 .AND. kl.GT.0 ) THEN
476 *
477 * A has been reduced to lower bidiagonal form
478 *
479 * Transform lower bidiagonal form to upper bidiagonal by applying
480 * plane rotations from the left, storing diagonal elements in D
481 * and off-diagonal elements in E
482 *
483  DO 100 i = 1, min( m-1, n )
484  CALL dlartg( ab( 1, i ), ab( 2, i ), rc, rs, ra )
485  d( i ) = ra
486  IF( i.LT.n ) THEN
487  e( i ) = rs*ab( 1, i+1 )
488  ab( 1, i+1 ) = rc*ab( 1, i+1 )
489  END IF
490  IF( wantq )
491  $ CALL drot( m, q( 1, i ), 1, q( 1, i+1 ), 1, rc, rs )
492  IF( wantc )
493  $ CALL drot( ncc, c( i, 1 ), ldc, c( i+1, 1 ), ldc, rc,
494  $ rs )
495  100 CONTINUE
496  IF( m.LE.n )
497  $ d( m ) = ab( 1, m )
498  ELSE IF( ku.GT.0 ) THEN
499 *
500 * A has been reduced to upper bidiagonal form
501 *
502  IF( m.LT.n ) THEN
503 *
504 * Annihilate a(m,m+1) by applying plane rotations from the
505 * right, storing diagonal elements in D and off-diagonal
506 * elements in E
507 *
508  rb = ab( ku, m+1 )
509  DO 110 i = m, 1, -1
510  CALL dlartg( ab( ku+1, i ), rb, rc, rs, ra )
511  d( i ) = ra
512  IF( i.GT.1 ) THEN
513  rb = -rs*ab( ku, i )
514  e( i-1 ) = rc*ab( ku, i )
515  END IF
516  IF( wantpt )
517  $ CALL drot( n, pt( i, 1 ), ldpt, pt( m+1, 1 ), ldpt,
518  $ rc, rs )
519  110 CONTINUE
520  ELSE
521 *
522 * Copy off-diagonal elements to E and diagonal elements to D
523 *
524  DO 120 i = 1, minmn - 1
525  e( i ) = ab( ku, i+1 )
526  120 CONTINUE
527  DO 130 i = 1, minmn
528  d( i ) = ab( ku+1, i )
529  130 CONTINUE
530  END IF
531  ELSE
532 *
533 * A is diagonal. Set elements of E to zero and copy diagonal
534 * elements to D.
535 *
536  DO 140 i = 1, minmn - 1
537  e( i ) = zero
538  140 CONTINUE
539  DO 150 i = 1, minmn
540  d( i ) = ab( 1, i )
541  150 CONTINUE
542  END IF
543  RETURN
544 *
545 * End of DGBBRD
546 *
subroutine dlartv(N, X, INCX, Y, INCY, C, S, INCC)
DLARTV applies a vector of plane rotations with real cosines and real sines to the elements of a pair...
Definition: dlartv.f:110
subroutine dlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: dlaset.f:112
subroutine dlartg(F, G, CS, SN, R)
DLARTG generates a plane rotation with real cosine and real sine.
Definition: dlartg.f:99
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine drot(N, DX, INCX, DY, INCY, C, S)
DROT
Definition: drot.f:53
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dlargv(N, X, INCX, Y, INCY, C, INCC)
DLARGV generates a vector of plane rotations with real cosines and real sines.
Definition: dlargv.f:106

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbcon ( character  NORM,
integer  N,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
integer, dimension( * )  IPIV,
double precision  ANORM,
double precision  RCOND,
double precision, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

DGBCON

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

Purpose:
 DGBCON estimates the reciprocal of the condition number of a real
 general band matrix A, in either the 1-norm or the infinity-norm,
 using the LU factorization computed by DGBTRF.

 An estimate is obtained for norm(inv(A)), and the reciprocal of the
 condition number is computed as
    RCOND = 1 / ( norm(A) * norm(inv(A)) ).
Parameters
[in]NORM
          NORM is CHARACTER*1
          Specifies whether the 1-norm condition number or the
          infinity-norm condition number is required:
          = '1' or 'O':  1-norm;
          = 'I':         Infinity-norm.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          Details of the LU factorization of the band matrix A, as
          computed by DGBTRF.  U is stored as an upper triangular band
          matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
          the multipliers used during the factorization are stored in
          rows KL+KU+2 to 2*KL+KU+1.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= 2*KL+KU+1.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices; for 1 <= i <= N, row i of the matrix was
          interchanged with row IPIV(i).
[in]ANORM
          ANORM is DOUBLE PRECISION
          If NORM = '1' or 'O', the 1-norm of the original matrix A.
          If NORM = 'I', the infinity-norm of the original matrix A.
[out]RCOND
          RCOND is DOUBLE PRECISION
          The reciprocal of the condition number of the matrix A,
          computed as RCOND = 1/(norm(A) * norm(inv(A))).
[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
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 148 of file dgbcon.f.

148 *
149 * -- LAPACK computational routine (version 3.4.0) --
150 * -- LAPACK is a software package provided by Univ. of Tennessee, --
151 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
152 * November 2011
153 *
154 * .. Scalar Arguments ..
155  CHARACTER norm
156  INTEGER info, kl, ku, ldab, n
157  DOUBLE PRECISION anorm, rcond
158 * ..
159 * .. Array Arguments ..
160  INTEGER ipiv( * ), iwork( * )
161  DOUBLE PRECISION ab( ldab, * ), work( * )
162 * ..
163 *
164 * =====================================================================
165 *
166 * .. Parameters ..
167  DOUBLE PRECISION one, zero
168  parameter( one = 1.0d+0, zero = 0.0d+0 )
169 * ..
170 * .. Local Scalars ..
171  LOGICAL lnoti, onenrm
172  CHARACTER normin
173  INTEGER ix, j, jp, kase, kase1, kd, lm
174  DOUBLE PRECISION ainvnm, scale, smlnum, t
175 * ..
176 * .. Local Arrays ..
177  INTEGER isave( 3 )
178 * ..
179 * .. External Functions ..
180  LOGICAL lsame
181  INTEGER idamax
182  DOUBLE PRECISION ddot, dlamch
183  EXTERNAL lsame, idamax, ddot, dlamch
184 * ..
185 * .. External Subroutines ..
186  EXTERNAL daxpy, dlacn2, dlatbs, drscl, xerbla
187 * ..
188 * .. Intrinsic Functions ..
189  INTRINSIC abs, min
190 * ..
191 * .. Executable Statements ..
192 *
193 * Test the input parameters.
194 *
195  info = 0
196  onenrm = norm.EQ.'1' .OR. lsame( norm, 'O' )
197  IF( .NOT.onenrm .AND. .NOT.lsame( norm, 'I' ) ) THEN
198  info = -1
199  ELSE IF( n.LT.0 ) THEN
200  info = -2
201  ELSE IF( kl.LT.0 ) THEN
202  info = -3
203  ELSE IF( ku.LT.0 ) THEN
204  info = -4
205  ELSE IF( ldab.LT.2*kl+ku+1 ) THEN
206  info = -6
207  ELSE IF( anorm.LT.zero ) THEN
208  info = -8
209  END IF
210  IF( info.NE.0 ) THEN
211  CALL xerbla( 'DGBCON', -info )
212  RETURN
213  END IF
214 *
215 * Quick return if possible
216 *
217  rcond = zero
218  IF( n.EQ.0 ) THEN
219  rcond = one
220  RETURN
221  ELSE IF( anorm.EQ.zero ) THEN
222  RETURN
223  END IF
224 *
225  smlnum = dlamch( 'Safe minimum' )
226 *
227 * Estimate the norm of inv(A).
228 *
229  ainvnm = zero
230  normin = 'N'
231  IF( onenrm ) THEN
232  kase1 = 1
233  ELSE
234  kase1 = 2
235  END IF
236  kd = kl + ku + 1
237  lnoti = kl.GT.0
238  kase = 0
239  10 CONTINUE
240  CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
241  IF( kase.NE.0 ) THEN
242  IF( kase.EQ.kase1 ) THEN
243 *
244 * Multiply by inv(L).
245 *
246  IF( lnoti ) THEN
247  DO 20 j = 1, n - 1
248  lm = min( kl, n-j )
249  jp = ipiv( j )
250  t = work( jp )
251  IF( jp.NE.j ) THEN
252  work( jp ) = work( j )
253  work( j ) = t
254  END IF
255  CALL daxpy( lm, -t, ab( kd+1, j ), 1, work( j+1 ), 1 )
256  20 CONTINUE
257  END IF
258 *
259 * Multiply by inv(U).
260 *
261  CALL dlatbs( 'Upper', 'No transpose', 'Non-unit', normin, n,
262  $ kl+ku, ab, ldab, work, scale, work( 2*n+1 ),
263  $ info )
264  ELSE
265 *
266 * Multiply by inv(U**T).
267 *
268  CALL dlatbs( 'Upper', 'Transpose', 'Non-unit', normin, n,
269  $ kl+ku, ab, ldab, work, scale, work( 2*n+1 ),
270  $ info )
271 *
272 * Multiply by inv(L**T).
273 *
274  IF( lnoti ) THEN
275  DO 30 j = n - 1, 1, -1
276  lm = min( kl, n-j )
277  work( j ) = work( j ) - ddot( lm, ab( kd+1, j ), 1,
278  $ work( j+1 ), 1 )
279  jp = ipiv( j )
280  IF( jp.NE.j ) THEN
281  t = work( jp )
282  work( jp ) = work( j )
283  work( j ) = t
284  END IF
285  30 CONTINUE
286  END IF
287  END IF
288 *
289 * Divide X by 1/SCALE if doing so will not cause overflow.
290 *
291  normin = 'Y'
292  IF( scale.NE.one ) THEN
293  ix = idamax( n, work, 1 )
294  IF( scale.LT.abs( work( ix ) )*smlnum .OR. scale.EQ.zero )
295  $ GO TO 40
296  CALL drscl( n, scale, work, 1 )
297  END IF
298  GO TO 10
299  END IF
300 *
301 * Compute the estimate of the reciprocal condition number.
302 *
303  IF( ainvnm.NE.zero )
304  $ rcond = ( one / ainvnm ) / anorm
305 *
306  40 CONTINUE
307  RETURN
308 *
309 * End of DGBCON
310 *
subroutine dlatbs(UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X, SCALE, CNORM, INFO)
DLATBS solves a triangular banded system of equations.
Definition: dlatbs.f:244
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
double precision function ddot(N, DX, INCX, DY, INCY)
DDOT
Definition: ddot.f:53
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
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53
subroutine drscl(N, SA, SX, INCX)
DRSCL multiplies a vector by the reciprocal of a real scalar.
Definition: drscl.f:86
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:54

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbequ ( integer  M,
integer  N,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( * )  R,
double precision, dimension( * )  C,
double precision  ROWCND,
double precision  COLCND,
double precision  AMAX,
integer  INFO 
)

DGBEQU

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

Purpose:
 DGBEQU computes row and column scalings intended to equilibrate an
 M-by-N band matrix A and reduce its condition number.  R returns the
 row scale factors and C the column scale factors, chosen to try to
 make the largest element in each row and column of the matrix B with
 elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.

 R(i) and C(j) are restricted to be between SMLNUM = smallest safe
 number and BIGNUM = largest safe number.  Use of these scaling
 factors is not guaranteed to reduce the condition number of A but
 works well in practice.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          The band matrix A, stored in rows 1 to KL+KU+1.  The j-th
          column of A is stored in the j-th column of the array AB as
          follows:
          AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl).
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= KL+KU+1.
[out]R
          R is DOUBLE PRECISION array, dimension (M)
          If INFO = 0, or INFO > M, R contains the row scale factors
          for A.
[out]C
          C is DOUBLE PRECISION array, dimension (N)
          If INFO = 0, C contains the column scale factors for A.
[out]ROWCND
          ROWCND is DOUBLE PRECISION
          If INFO = 0 or INFO > M, ROWCND contains the ratio of the
          smallest R(i) to the largest R(i).  If ROWCND >= 0.1 and
          AMAX is neither too large nor too small, it is not worth
          scaling by R.
[out]COLCND
          COLCND is DOUBLE PRECISION
          If INFO = 0, COLCND contains the ratio of the smallest
          C(i) to the largest C(i).  If COLCND >= 0.1, it is not
          worth scaling by C.
[out]AMAX
          AMAX is DOUBLE PRECISION
          Absolute value of largest matrix element.  If AMAX is very
          close to overflow or very close to underflow, the matrix
          should be scaled.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i, and i is
                <= M:  the i-th row of A is exactly zero
                >  M:  the (i-M)-th column of A is exactly zero
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 155 of file dgbequ.f.

155 *
156 * -- LAPACK computational routine (version 3.4.0) --
157 * -- LAPACK is a software package provided by Univ. of Tennessee, --
158 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
159 * November 2011
160 *
161 * .. Scalar Arguments ..
162  INTEGER info, kl, ku, ldab, m, n
163  DOUBLE PRECISION amax, colcnd, rowcnd
164 * ..
165 * .. Array Arguments ..
166  DOUBLE PRECISION ab( ldab, * ), c( * ), r( * )
167 * ..
168 *
169 * =====================================================================
170 *
171 * .. Parameters ..
172  DOUBLE PRECISION one, zero
173  parameter( one = 1.0d+0, zero = 0.0d+0 )
174 * ..
175 * .. Local Scalars ..
176  INTEGER i, j, kd
177  DOUBLE PRECISION bignum, rcmax, rcmin, smlnum
178 * ..
179 * .. External Functions ..
180  DOUBLE PRECISION dlamch
181  EXTERNAL dlamch
182 * ..
183 * .. External Subroutines ..
184  EXTERNAL xerbla
185 * ..
186 * .. Intrinsic Functions ..
187  INTRINSIC abs, max, min
188 * ..
189 * .. Executable Statements ..
190 *
191 * Test the input parameters
192 *
193  info = 0
194  IF( m.LT.0 ) THEN
195  info = -1
196  ELSE IF( n.LT.0 ) THEN
197  info = -2
198  ELSE IF( kl.LT.0 ) THEN
199  info = -3
200  ELSE IF( ku.LT.0 ) THEN
201  info = -4
202  ELSE IF( ldab.LT.kl+ku+1 ) THEN
203  info = -6
204  END IF
205  IF( info.NE.0 ) THEN
206  CALL xerbla( 'DGBEQU', -info )
207  RETURN
208  END IF
209 *
210 * Quick return if possible
211 *
212  IF( m.EQ.0 .OR. n.EQ.0 ) THEN
213  rowcnd = one
214  colcnd = one
215  amax = zero
216  RETURN
217  END IF
218 *
219 * Get machine constants.
220 *
221  smlnum = dlamch( 'S' )
222  bignum = one / smlnum
223 *
224 * Compute row scale factors.
225 *
226  DO 10 i = 1, m
227  r( i ) = zero
228  10 CONTINUE
229 *
230 * Find the maximum element in each row.
231 *
232  kd = ku + 1
233  DO 30 j = 1, n
234  DO 20 i = max( j-ku, 1 ), min( j+kl, m )
235  r( i ) = max( r( i ), abs( ab( kd+i-j, j ) ) )
236  20 CONTINUE
237  30 CONTINUE
238 *
239 * Find the maximum and minimum scale factors.
240 *
241  rcmin = bignum
242  rcmax = zero
243  DO 40 i = 1, m
244  rcmax = max( rcmax, r( i ) )
245  rcmin = min( rcmin, r( i ) )
246  40 CONTINUE
247  amax = rcmax
248 *
249  IF( rcmin.EQ.zero ) THEN
250 *
251 * Find the first zero scale factor and return an error code.
252 *
253  DO 50 i = 1, m
254  IF( r( i ).EQ.zero ) THEN
255  info = i
256  RETURN
257  END IF
258  50 CONTINUE
259  ELSE
260 *
261 * Invert the scale factors.
262 *
263  DO 60 i = 1, m
264  r( i ) = one / min( max( r( i ), smlnum ), bignum )
265  60 CONTINUE
266 *
267 * Compute ROWCND = min(R(I)) / max(R(I))
268 *
269  rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
270  END IF
271 *
272 * Compute column scale factors
273 *
274  DO 70 j = 1, n
275  c( j ) = zero
276  70 CONTINUE
277 *
278 * Find the maximum element in each column,
279 * assuming the row scaling computed above.
280 *
281  kd = ku + 1
282  DO 90 j = 1, n
283  DO 80 i = max( j-ku, 1 ), min( j+kl, m )
284  c( j ) = max( c( j ), abs( ab( kd+i-j, j ) )*r( i ) )
285  80 CONTINUE
286  90 CONTINUE
287 *
288 * Find the maximum and minimum scale factors.
289 *
290  rcmin = bignum
291  rcmax = zero
292  DO 100 j = 1, n
293  rcmin = min( rcmin, c( j ) )
294  rcmax = max( rcmax, c( j ) )
295  100 CONTINUE
296 *
297  IF( rcmin.EQ.zero ) THEN
298 *
299 * Find the first zero scale factor and return an error code.
300 *
301  DO 110 j = 1, n
302  IF( c( j ).EQ.zero ) THEN
303  info = m + j
304  RETURN
305  END IF
306  110 CONTINUE
307  ELSE
308 *
309 * Invert the scale factors.
310 *
311  DO 120 j = 1, n
312  c( j ) = one / min( max( c( j ), smlnum ), bignum )
313  120 CONTINUE
314 *
315 * Compute COLCND = min(C(J)) / max(C(J))
316 *
317  colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
318  END IF
319 *
320  RETURN
321 *
322 * End of DGBEQU
323 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbequb ( integer  M,
integer  N,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( * )  R,
double precision, dimension( * )  C,
double precision  ROWCND,
double precision  COLCND,
double precision  AMAX,
integer  INFO 
)

DGBEQUB

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

Purpose:
 DGBEQUB computes row and column scalings intended to equilibrate an
 M-by-N matrix A and reduce its condition number.  R returns the row
 scale factors and C the column scale factors, chosen to try to make
 the largest element in each row and column of the matrix B with
 elements B(i,j)=R(i)*A(i,j)*C(j) have an absolute value of at most
 the radix.

 R(i) and C(j) are restricted to be a power of the radix between
 SMLNUM = smallest safe number and BIGNUM = largest safe number.  Use
 of these scaling factors is not guaranteed to reduce the condition
 number of A but works well in practice.

 This routine differs from DGEEQU by restricting the scaling factors
 to a power of the radix.  Baring over- and underflow, scaling by
 these factors introduces no additional rounding errors.  However, the
 scaled entries' magnitured are no longer approximately 1 but lie
 between sqrt(radix) and 1/sqrt(radix).
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
          The j-th column of A is stored in the j-th column of the
          array AB as follows:
          AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array A.  LDAB >= max(1,M).
[out]R
          R is DOUBLE PRECISION array, dimension (M)
          If INFO = 0 or INFO > M, R contains the row scale factors
          for A.
[out]C
          C is DOUBLE PRECISION array, dimension (N)
          If INFO = 0,  C contains the column scale factors for A.
[out]ROWCND
          ROWCND is DOUBLE PRECISION
          If INFO = 0 or INFO > M, ROWCND contains the ratio of the
          smallest R(i) to the largest R(i).  If ROWCND >= 0.1 and
          AMAX is neither too large nor too small, it is not worth
          scaling by R.
[out]COLCND
          COLCND is DOUBLE PRECISION
          If INFO = 0, COLCND contains the ratio of the smallest
          C(i) to the largest C(i).  If COLCND >= 0.1, it is not
          worth scaling by C.
[out]AMAX
          AMAX is DOUBLE PRECISION
          Absolute value of largest matrix element.  If AMAX is very
          close to overflow or very close to underflow, the matrix
          should be scaled.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i,  and i is
                <= M:  the i-th row of A is exactly zero
                >  M:  the (i-M)-th column of A is exactly zero
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 162 of file dgbequb.f.

162 *
163 * -- LAPACK computational routine (version 3.4.0) --
164 * -- LAPACK is a software package provided by Univ. of Tennessee, --
165 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
166 * November 2011
167 *
168 * .. Scalar Arguments ..
169  INTEGER info, kl, ku, ldab, m, n
170  DOUBLE PRECISION amax, colcnd, rowcnd
171 * ..
172 * .. Array Arguments ..
173  DOUBLE PRECISION ab( ldab, * ), c( * ), r( * )
174 * ..
175 *
176 * =====================================================================
177 *
178 * .. Parameters ..
179  DOUBLE PRECISION one, zero
180  parameter( one = 1.0d+0, zero = 0.0d+0 )
181 * ..
182 * .. Local Scalars ..
183  INTEGER i, j, kd
184  DOUBLE PRECISION bignum, rcmax, rcmin, smlnum, radix, logrdx
185 * ..
186 * .. External Functions ..
187  DOUBLE PRECISION dlamch
188  EXTERNAL dlamch
189 * ..
190 * .. External Subroutines ..
191  EXTERNAL xerbla
192 * ..
193 * .. Intrinsic Functions ..
194  INTRINSIC abs, max, min, log
195 * ..
196 * .. Executable Statements ..
197 *
198 * Test the input parameters.
199 *
200  info = 0
201  IF( m.LT.0 ) THEN
202  info = -1
203  ELSE IF( n.LT.0 ) THEN
204  info = -2
205  ELSE IF( kl.LT.0 ) THEN
206  info = -3
207  ELSE IF( ku.LT.0 ) THEN
208  info = -4
209  ELSE IF( ldab.LT.kl+ku+1 ) THEN
210  info = -6
211  END IF
212  IF( info.NE.0 ) THEN
213  CALL xerbla( 'DGBEQUB', -info )
214  RETURN
215  END IF
216 *
217 * Quick return if possible.
218 *
219  IF( m.EQ.0 .OR. n.EQ.0 ) THEN
220  rowcnd = one
221  colcnd = one
222  amax = zero
223  RETURN
224  END IF
225 *
226 * Get machine constants. Assume SMLNUM is a power of the radix.
227 *
228  smlnum = dlamch( 'S' )
229  bignum = one / smlnum
230  radix = dlamch( 'B' )
231  logrdx = log(radix)
232 *
233 * Compute row scale factors.
234 *
235  DO 10 i = 1, m
236  r( i ) = zero
237  10 CONTINUE
238 *
239 * Find the maximum element in each row.
240 *
241  kd = ku + 1
242  DO 30 j = 1, n
243  DO 20 i = max( j-ku, 1 ), min( j+kl, m )
244  r( i ) = max( r( i ), abs( ab( kd+i-j, j ) ) )
245  20 CONTINUE
246  30 CONTINUE
247  DO i = 1, m
248  IF( r( i ).GT.zero ) THEN
249  r( i ) = radix**int( log( r( i ) ) / logrdx )
250  END IF
251  END DO
252 *
253 * Find the maximum and minimum scale factors.
254 *
255  rcmin = bignum
256  rcmax = zero
257  DO 40 i = 1, m
258  rcmax = max( rcmax, r( i ) )
259  rcmin = min( rcmin, r( i ) )
260  40 CONTINUE
261  amax = rcmax
262 *
263  IF( rcmin.EQ.zero ) THEN
264 *
265 * Find the first zero scale factor and return an error code.
266 *
267  DO 50 i = 1, m
268  IF( r( i ).EQ.zero ) THEN
269  info = i
270  RETURN
271  END IF
272  50 CONTINUE
273  ELSE
274 *
275 * Invert the scale factors.
276 *
277  DO 60 i = 1, m
278  r( i ) = one / min( max( r( i ), smlnum ), bignum )
279  60 CONTINUE
280 *
281 * Compute ROWCND = min(R(I)) / max(R(I)).
282 *
283  rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
284  END IF
285 *
286 * Compute column scale factors.
287 *
288  DO 70 j = 1, n
289  c( j ) = zero
290  70 CONTINUE
291 *
292 * Find the maximum element in each column,
293 * assuming the row scaling computed above.
294 *
295  DO 90 j = 1, n
296  DO 80 i = max( j-ku, 1 ), min( j+kl, m )
297  c( j ) = max( c( j ), abs( ab( kd+i-j, j ) )*r( i ) )
298  80 CONTINUE
299  IF( c( j ).GT.zero ) THEN
300  c( j ) = radix**int( log( c( j ) ) / logrdx )
301  END IF
302  90 CONTINUE
303 *
304 * Find the maximum and minimum scale factors.
305 *
306  rcmin = bignum
307  rcmax = zero
308  DO 100 j = 1, n
309  rcmin = min( rcmin, c( j ) )
310  rcmax = max( rcmax, c( j ) )
311  100 CONTINUE
312 *
313  IF( rcmin.EQ.zero ) THEN
314 *
315 * Find the first zero scale factor and return an error code.
316 *
317  DO 110 j = 1, n
318  IF( c( j ).EQ.zero ) THEN
319  info = m + j
320  RETURN
321  END IF
322  110 CONTINUE
323  ELSE
324 *
325 * Invert the scale factors.
326 *
327  DO 120 j = 1, n
328  c( j ) = one / min( max( c( j ), smlnum ), bignum )
329  120 CONTINUE
330 *
331 * Compute COLCND = min(C(J)) / max(C(J)).
332 *
333  colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
334  END IF
335 *
336  RETURN
337 *
338 * End of DGBEQUB
339 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbrfs ( character  TRANS,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( ldafb, * )  AFB,
integer  LDAFB,
integer, dimension( * )  IPIV,
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 
)

DGBRFS

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

Purpose:
 DGBRFS improves the computed solution to a system of linear
 equations when the coefficient matrix is banded, and provides
 error bounds and backward error estimates for the solution.
Parameters
[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]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 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 original band matrix A, stored in rows 1 to KL+KU+1.
          The j-th column of A is stored in the j-th column of the
          array AB as follows:
          AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= KL+KU+1.
[in]AFB
          AFB is DOUBLE PRECISION array, dimension (LDAFB,N)
          Details of the LU factorization of the band matrix A, as
          computed by DGBTRF.  U is stored as an upper triangular band
          matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
          the multipliers used during the factorization are stored in
          rows KL+KU+2 to 2*KL+KU+1.
[in]LDAFB
          LDAFB is INTEGER
          The leading dimension of the array AFB.  LDAFB >= 2*KL*KU+1.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices from DGBTRF; for 1<=i<=N, row i of the
          matrix was interchanged with row IPIV(i).
[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,out]X
          X is DOUBLE PRECISION array, dimension (LDX,NRHS)
          On entry, the solution matrix X, as computed by DGBTRS.
          On exit, the improved 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
Internal Parameters:
  ITMAX is the maximum number of steps of iterative refinement.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 207 of file dgbrfs.f.

207 *
208 * -- LAPACK computational routine (version 3.4.0) --
209 * -- LAPACK is a software package provided by Univ. of Tennessee, --
210 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
211 * November 2011
212 *
213 * .. Scalar Arguments ..
214  CHARACTER trans
215  INTEGER info, kl, ku, ldab, ldafb, ldb, ldx, n, nrhs
216 * ..
217 * .. Array Arguments ..
218  INTEGER ipiv( * ), iwork( * )
219  DOUBLE PRECISION ab( ldab, * ), afb( ldafb, * ), b( ldb, * ),
220  $ berr( * ), ferr( * ), work( * ), x( ldx, * )
221 * ..
222 *
223 * =====================================================================
224 *
225 * .. Parameters ..
226  INTEGER itmax
227  parameter( itmax = 5 )
228  DOUBLE PRECISION zero
229  parameter( zero = 0.0d+0 )
230  DOUBLE PRECISION one
231  parameter( one = 1.0d+0 )
232  DOUBLE PRECISION two
233  parameter( two = 2.0d+0 )
234  DOUBLE PRECISION three
235  parameter( three = 3.0d+0 )
236 * ..
237 * .. Local Scalars ..
238  LOGICAL notran
239  CHARACTER transt
240  INTEGER count, i, j, k, kase, kk, nz
241  DOUBLE PRECISION eps, lstres, s, safe1, safe2, safmin, xk
242 * ..
243 * .. Local Arrays ..
244  INTEGER isave( 3 )
245 * ..
246 * .. External Subroutines ..
247  EXTERNAL daxpy, dcopy, dgbmv, dgbtrs, dlacn2, xerbla
248 * ..
249 * .. Intrinsic Functions ..
250  INTRINSIC abs, max, min
251 * ..
252 * .. External Functions ..
253  LOGICAL lsame
254  DOUBLE PRECISION dlamch
255  EXTERNAL lsame, dlamch
256 * ..
257 * .. Executable Statements ..
258 *
259 * Test the input parameters.
260 *
261  info = 0
262  notran = lsame( trans, 'N' )
263  IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
264  $ lsame( trans, 'C' ) ) THEN
265  info = -1
266  ELSE IF( n.LT.0 ) THEN
267  info = -2
268  ELSE IF( kl.LT.0 ) THEN
269  info = -3
270  ELSE IF( ku.LT.0 ) THEN
271  info = -4
272  ELSE IF( nrhs.LT.0 ) THEN
273  info = -5
274  ELSE IF( ldab.LT.kl+ku+1 ) THEN
275  info = -7
276  ELSE IF( ldafb.LT.2*kl+ku+1 ) THEN
277  info = -9
278  ELSE IF( ldb.LT.max( 1, n ) ) THEN
279  info = -12
280  ELSE IF( ldx.LT.max( 1, n ) ) THEN
281  info = -14
282  END IF
283  IF( info.NE.0 ) THEN
284  CALL xerbla( 'DGBRFS', -info )
285  RETURN
286  END IF
287 *
288 * Quick return if possible
289 *
290  IF( n.EQ.0 .OR. nrhs.EQ.0 ) THEN
291  DO 10 j = 1, nrhs
292  ferr( j ) = zero
293  berr( j ) = zero
294  10 CONTINUE
295  RETURN
296  END IF
297 *
298  IF( notran ) THEN
299  transt = 'T'
300  ELSE
301  transt = 'N'
302  END IF
303 *
304 * NZ = maximum number of nonzero elements in each row of A, plus 1
305 *
306  nz = min( kl+ku+2, n+1 )
307  eps = dlamch( 'Epsilon' )
308  safmin = dlamch( 'Safe minimum' )
309  safe1 = nz*safmin
310  safe2 = safe1 / eps
311 *
312 * Do for each right hand side
313 *
314  DO 140 j = 1, nrhs
315 *
316  count = 1
317  lstres = three
318  20 CONTINUE
319 *
320 * Loop until stopping criterion is satisfied.
321 *
322 * Compute residual R = B - op(A) * X,
323 * where op(A) = A, A**T, or A**H, depending on TRANS.
324 *
325  CALL dcopy( n, b( 1, j ), 1, work( n+1 ), 1 )
326  CALL dgbmv( trans, n, n, kl, ku, -one, ab, ldab, x( 1, j ), 1,
327  $ one, work( n+1 ), 1 )
328 *
329 * Compute componentwise relative backward error from formula
330 *
331 * max(i) ( abs(R(i)) / ( abs(op(A))*abs(X) + abs(B) )(i) )
332 *
333 * where abs(Z) is the componentwise absolute value of the matrix
334 * or vector Z. If the i-th component of the denominator is less
335 * than SAFE2, then SAFE1 is added to the i-th components of the
336 * numerator and denominator before dividing.
337 *
338  DO 30 i = 1, n
339  work( i ) = abs( b( i, j ) )
340  30 CONTINUE
341 *
342 * Compute abs(op(A))*abs(X) + abs(B).
343 *
344  IF( notran ) THEN
345  DO 50 k = 1, n
346  kk = ku + 1 - k
347  xk = abs( x( k, j ) )
348  DO 40 i = max( 1, k-ku ), min( n, k+kl )
349  work( i ) = work( i ) + abs( ab( kk+i, k ) )*xk
350  40 CONTINUE
351  50 CONTINUE
352  ELSE
353  DO 70 k = 1, n
354  s = zero
355  kk = ku + 1 - k
356  DO 60 i = max( 1, k-ku ), min( n, k+kl )
357  s = s + abs( ab( kk+i, k ) )*abs( x( i, j ) )
358  60 CONTINUE
359  work( k ) = work( k ) + s
360  70 CONTINUE
361  END IF
362  s = zero
363  DO 80 i = 1, n
364  IF( work( i ).GT.safe2 ) THEN
365  s = max( s, abs( work( n+i ) ) / work( i ) )
366  ELSE
367  s = max( s, ( abs( work( n+i ) )+safe1 ) /
368  $ ( work( i )+safe1 ) )
369  END IF
370  80 CONTINUE
371  berr( j ) = s
372 *
373 * Test stopping criterion. Continue iterating if
374 * 1) The residual BERR(J) is larger than machine epsilon, and
375 * 2) BERR(J) decreased by at least a factor of 2 during the
376 * last iteration, and
377 * 3) At most ITMAX iterations tried.
378 *
379  IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
380  $ count.LE.itmax ) THEN
381 *
382 * Update solution and try again.
383 *
384  CALL dgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv,
385  $ work( n+1 ), n, info )
386  CALL daxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
387  lstres = berr( j )
388  count = count + 1
389  GO TO 20
390  END IF
391 *
392 * Bound error from formula
393 *
394 * norm(X - XTRUE) / norm(X) .le. FERR =
395 * norm( abs(inv(op(A)))*
396 * ( abs(R) + NZ*EPS*( abs(op(A))*abs(X)+abs(B) ))) / norm(X)
397 *
398 * where
399 * norm(Z) is the magnitude of the largest component of Z
400 * inv(op(A)) is the inverse of op(A)
401 * abs(Z) is the componentwise absolute value of the matrix or
402 * vector Z
403 * NZ is the maximum number of nonzeros in any row of A, plus 1
404 * EPS is machine epsilon
405 *
406 * The i-th component of abs(R)+NZ*EPS*(abs(op(A))*abs(X)+abs(B))
407 * is incremented by SAFE1 if the i-th component of
408 * abs(op(A))*abs(X) + abs(B) is less than SAFE2.
409 *
410 * Use DLACN2 to estimate the infinity-norm of the matrix
411 * inv(op(A)) * diag(W),
412 * where W = abs(R) + NZ*EPS*( abs(op(A))*abs(X)+abs(B) )))
413 *
414  DO 90 i = 1, n
415  IF( work( i ).GT.safe2 ) THEN
416  work( i ) = abs( work( n+i ) ) + nz*eps*work( i )
417  ELSE
418  work( i ) = abs( work( n+i ) ) + nz*eps*work( i ) + safe1
419  END IF
420  90 CONTINUE
421 *
422  kase = 0
423  100 CONTINUE
424  CALL dlacn2( n, work( 2*n+1 ), work( n+1 ), iwork, ferr( j ),
425  $ kase, isave )
426  IF( kase.NE.0 ) THEN
427  IF( kase.EQ.1 ) THEN
428 *
429 * Multiply by diag(W)*inv(op(A)**T).
430 *
431  CALL dgbtrs( transt, n, kl, ku, 1, afb, ldafb, ipiv,
432  $ work( n+1 ), n, info )
433  DO 110 i = 1, n
434  work( n+i ) = work( n+i )*work( i )
435  110 CONTINUE
436  ELSE
437 *
438 * Multiply by inv(op(A))*diag(W).
439 *
440  DO 120 i = 1, n
441  work( n+i ) = work( n+i )*work( i )
442  120 CONTINUE
443  CALL dgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv,
444  $ work( n+1 ), n, info )
445  END IF
446  GO TO 100
447  END IF
448 *
449 * Normalize error.
450 *
451  lstres = zero
452  DO 130 i = 1, n
453  lstres = max( lstres, abs( x( i, j ) ) )
454  130 CONTINUE
455  IF( lstres.NE.zero )
456  $ ferr( j ) = ferr( j ) / lstres
457 *
458  140 CONTINUE
459 *
460  RETURN
461 *
462 * End of DGBRFS
463 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dgbmv(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
DGBMV
Definition: dgbmv.f:187
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
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:53
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:54
subroutine dgbtrs(TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
DGBTRS
Definition: dgbtrs.f:140

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbrfsx ( character  TRANS,
character  EQUED,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( ldafb, * )  AFB,
integer  LDAFB,
integer, dimension( * )  IPIV,
double precision, dimension( * )  R,
double precision, dimension( * )  C,
double precision, dimension( ldb, * )  B,
integer  LDB,
double precision, dimension( ldx , * )  X,
integer  LDX,
double precision  RCOND,
double precision, dimension( * )  BERR,
integer  N_ERR_BNDS,
double precision, dimension( nrhs, * )  ERR_BNDS_NORM,
double precision, dimension( nrhs, * )  ERR_BNDS_COMP,
integer  NPARAMS,
double precision, dimension( * )  PARAMS,
double precision, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

DGBRFSX

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

Purpose:
    DGBRFSX improves the computed solution to a system of linear
    equations and provides error bounds and backward error estimates
    for the solution.  In addition to normwise error bound, the code
    provides maximum componentwise error bound if possible.  See
    comments for ERR_BNDS_NORM and ERR_BNDS_COMP for details of the
    error bounds.

    The original system of linear equations may have been equilibrated
    before calling this routine, as described by arguments EQUED, R
    and C below. In this case, the solution and error bounds returned
    are for the original unequilibrated system.
     Some optional parameters are bundled in the PARAMS array.  These
     settings determine how refinement is performed, but often the
     defaults are acceptable.  If the defaults are acceptable, users
     can pass NPARAMS = 0 which prevents the source code from accessing
     the PARAMS argument.
Parameters
[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]EQUED
          EQUED is CHARACTER*1
     Specifies the form of equilibration that was done to A
     before calling this routine. This is needed to compute
     the solution and error bounds correctly.
       = 'N':  No equilibration
       = 'R':  Row equilibration, i.e., A has been premultiplied by
               diag(R).
       = 'C':  Column equilibration, i.e., A has been postmultiplied
               by diag(C).
       = 'B':  Both row and column equilibration, i.e., A has been
               replaced by diag(R) * A * diag(C).
               The right hand side B has been changed accordingly.
[in]N
          N is INTEGER
     The order of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
     The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
     The number of superdiagonals within the band of A.  KU >= 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 original band matrix A, stored in rows 1 to KL+KU+1.
     The j-th column of A is stored in the j-th column of the
     array AB as follows:
     AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
[in]LDAB
          LDAB is INTEGER
     The leading dimension of the array AB.  LDAB >= KL+KU+1.
[in]AFB
          AFB is DOUBLE PRECISION array, dimension (LDAFB,N)
     Details of the LU factorization of the band matrix A, as
     computed by DGBTRF.  U is stored as an upper triangular band
     matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
     the multipliers used during the factorization are stored in
     rows KL+KU+2 to 2*KL+KU+1.
[in]LDAFB
          LDAFB is INTEGER
     The leading dimension of the array AFB.  LDAFB >= 2*KL*KU+1.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     The pivot indices from DGETRF; for 1<=i<=N, row i of the
     matrix was interchanged with row IPIV(i).
[in,out]R
          R is DOUBLE PRECISION array, dimension (N)
     The row scale factors for A.  If EQUED = 'R' or 'B', A is
     multiplied on the left by diag(R); if EQUED = 'N' or 'C', R
     is not accessed.  R is an input argument if FACT = 'F';
     otherwise, R is an output argument.  If FACT = 'F' and
     EQUED = 'R' or 'B', each element of R must be positive.
     If R is output, each element of R is a power of the radix.
     If R is input, each element of R should be a power of the radix
     to ensure a reliable solution and error estimates. Scaling by
     powers of the radix does not cause rounding errors unless the
     result underflows or overflows. Rounding errors during scaling
     lead to refining with a matrix that is not equivalent to the
     input matrix, producing error estimates that may not be
     reliable.
[in,out]C
          C is DOUBLE PRECISION array, dimension (N)
     The column scale factors for A.  If EQUED = 'C' or 'B', A is
     multiplied on the right by diag(C); if EQUED = 'N' or 'R', C
     is not accessed.  C is an input argument if FACT = 'F';
     otherwise, C is an output argument.  If FACT = 'F' and
     EQUED = 'C' or 'B', each element of C must be positive.
     If C is output, each element of C is a power of the radix.
     If C is input, each element of C should be a power of the radix
     to ensure a reliable solution and error estimates. Scaling by
     powers of the radix does not cause rounding errors unless the
     result underflows or overflows. Rounding errors during scaling
     lead to refining with a matrix that is not equivalent to the
     input matrix, producing error estimates that may not be
     reliable.
[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,out]X
          X is DOUBLE PRECISION array, dimension (LDX,NRHS)
     On entry, the solution matrix X, as computed by DGETRS.
     On exit, the improved solution matrix X.
[in]LDX
          LDX is INTEGER
     The leading dimension of the array X.  LDX >= max(1,N).
[out]RCOND
          RCOND is DOUBLE PRECISION
     Reciprocal scaled condition number.  This is an estimate of the
     reciprocal Skeel condition number of the matrix A after
     equilibration (if done).  If this is less than the machine
     precision (in particular, if it is zero), the matrix is singular
     to working precision.  Note that the error may still be small even
     if this number is very small and the matrix appears ill-
     conditioned.
[out]BERR
          BERR is DOUBLE PRECISION array, dimension (NRHS)
     Componentwise relative backward error.  This is 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).
[in]N_ERR_BNDS
          N_ERR_BNDS is INTEGER
     Number of error bounds to return for each right hand side
     and each type (normwise or componentwise).  See ERR_BNDS_NORM and
     ERR_BNDS_COMP below.
[out]ERR_BNDS_NORM
          ERR_BNDS_NORM is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     normwise relative error, which is defined as follows:

     Normwise relative error in the ith solution vector:
             max_j (abs(XTRUE(j,i) - X(j,i)))
            ------------------------------
                  max_j abs(X(j,i))

     The array is indexed by the type of error information as described
     below. There currently are up to three pieces of information
     returned.

     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_NORM(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * dlamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * dlamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated normwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * dlamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*A, where S scales each row by a power of the
              radix so all absolute row sums of Z are approximately 1.

     See Lapack Working Note 165 for further details and extra
     cautions.
[out]ERR_BNDS_COMP
          ERR_BNDS_COMP is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     componentwise relative error, which is defined as follows:

     Componentwise relative error in the ith solution vector:
                    abs(XTRUE(j,i) - X(j,i))
             max_j ----------------------
                         abs(X(j,i))

     The array is indexed by the right-hand side i (on which the
     componentwise relative error depends), and the type of error
     information as described below. There currently are up to three
     pieces of information returned for each right-hand side. If
     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
     the first (:,N_ERR_BNDS) entries are returned.

     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_COMP(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * dlamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * dlamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated componentwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * dlamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*(A*diag(x)), where x is the solution for the
              current right-hand side and S scales each row of
              A*diag(x) by a power of the radix so all absolute row
              sums of Z are approximately 1.

     See Lapack Working Note 165 for further details and extra
     cautions.
[in]NPARAMS
          NPARAMS is INTEGER
     Specifies the number of parameters set in PARAMS.  If .LE. 0, the
     PARAMS array is never referenced and default values are used.
[in,out]PARAMS
          PARAMS is DOUBLE PRECISION array, dimension (NPARAMS)
     Specifies algorithm parameters.  If an entry is .LT. 0.0, then
     that entry will be filled with default value used for that
     parameter.  Only positions up to NPARAMS are accessed; defaults
     are used for higher-numbered parameters.

       PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
            refinement or not.
         Default: 1.0D+0
            = 0.0 : No refinement is performed, and no error bounds are
                    computed.
            = 1.0 : Use the double-precision refinement algorithm,
                    possibly with doubled-single computations if the
                    compilation environment does not support DOUBLE
                    PRECISION.
              (other values are reserved for future use)

       PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
            computations allowed for refinement.
         Default: 10
         Aggressive: Set to 100 to permit convergence using approximate
                     factorizations or factorizations other than LU. If
                     the factorization uses a technique other than
                     Gaussian elimination, the guarantees in
                     err_bnds_norm and err_bnds_comp may no longer be
                     trustworthy.

       PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
            will attempt to find a solution with small componentwise
            relative error in the double-precision algorithm.  Positive
            is true, 0.0 is false.
         Default: 1.0 (attempt componentwise convergence)
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (4*N)
[out]IWORK
          IWORK is INTEGER array, dimension (N)
[out]INFO
          INFO is INTEGER
       = 0:  Successful exit. The solution to every right-hand side is
         guaranteed.
       < 0:  If INFO = -i, the i-th argument had an illegal value
       > 0 and <= N:  U(INFO,INFO) is exactly zero.  The factorization
         has been completed, but the factor U is exactly singular, so
         the solution and error bounds could not be computed. RCOND = 0
         is returned.
       = N+J: The solution corresponding to the Jth right-hand side is
         not guaranteed. The solutions corresponding to other right-
         hand sides K with K > J may not be guaranteed as well, but
         only the first such right-hand side is reported. If a small
         componentwise error is not requested (PARAMS(3) = 0.0) then
         the Jth right-hand side is the first with a normwise error
         bound that is not guaranteed (the smallest J such
         that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
         the Jth right-hand side is the first with either a normwise or
         componentwise error bound that is not guaranteed (the smallest
         J such that either ERR_BNDS_NORM(J,1) = 0.0 or
         ERR_BNDS_COMP(J,1) = 0.0). See the definition of
         ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
         about all of the right-hand sides check ERR_BNDS_NORM or
         ERR_BNDS_COMP.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
April 2012

Definition at line 442 of file dgbrfsx.f.

442 *
443 * -- LAPACK computational routine (version 3.4.1) --
444 * -- LAPACK is a software package provided by Univ. of Tennessee, --
445 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
446 * April 2012
447 *
448 * .. Scalar Arguments ..
449  CHARACTER trans, equed
450  INTEGER info, ldab, ldafb, ldb, ldx, n, kl, ku, nrhs,
451  $ nparams, n_err_bnds
452  DOUBLE PRECISION rcond
453 * ..
454 * .. Array Arguments ..
455  INTEGER ipiv( * ), iwork( * )
456  DOUBLE PRECISION ab( ldab, * ), afb( ldafb, * ), b( ldb, * ),
457  $ x( ldx , * ),work( * )
458  DOUBLE PRECISION r( * ), c( * ), params( * ), berr( * ),
459  $ err_bnds_norm( nrhs, * ),
460  $ err_bnds_comp( nrhs, * )
461 * ..
462 *
463 * ==================================================================
464 *
465 * .. Parameters ..
466  DOUBLE PRECISION zero, one
467  parameter( zero = 0.0d+0, one = 1.0d+0 )
468  DOUBLE PRECISION itref_default, ithresh_default
469  DOUBLE PRECISION componentwise_default, rthresh_default
470  DOUBLE PRECISION dzthresh_default
471  parameter( itref_default = 1.0d+0 )
472  parameter( ithresh_default = 10.0d+0 )
473  parameter( componentwise_default = 1.0d+0 )
474  parameter( rthresh_default = 0.5d+0 )
475  parameter( dzthresh_default = 0.25d+0 )
476  INTEGER la_linrx_itref_i, la_linrx_ithresh_i,
477  $ la_linrx_cwise_i
478  parameter( la_linrx_itref_i = 1,
479  $ la_linrx_ithresh_i = 2 )
480  parameter( la_linrx_cwise_i = 3 )
481  INTEGER la_linrx_trust_i, la_linrx_err_i,
482  $ la_linrx_rcond_i
483  parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
484  parameter( la_linrx_rcond_i = 3 )
485 * ..
486 * .. Local Scalars ..
487  CHARACTER(1) norm
488  LOGICAL rowequ, colequ, notran
489  INTEGER j, trans_type, prec_type, ref_type
490  INTEGER n_norms
491  DOUBLE PRECISION anorm, rcond_tmp
492  DOUBLE PRECISION illrcond_thresh, err_lbnd, cwise_wrong
493  LOGICAL ignore_cwise
494  INTEGER ithresh
495  DOUBLE PRECISION rthresh, unstable_thresh
496 * ..
497 * .. External Subroutines ..
498  EXTERNAL xerbla, dgbcon
499  EXTERNAL dla_gbrfsx_extended
500 * ..
501 * .. Intrinsic Functions ..
502  INTRINSIC max, sqrt
503 * ..
504 * .. External Functions ..
505  EXTERNAL lsame, blas_fpinfo_x, ilatrans, ilaprec
506  EXTERNAL dlamch, dlangb, dla_gbrcond
507  DOUBLE PRECISION dlamch, dlangb, dla_gbrcond
508  LOGICAL lsame
509  INTEGER blas_fpinfo_x
510  INTEGER ilatrans, ilaprec
511 * ..
512 * .. Executable Statements ..
513 *
514 * Check the input parameters.
515 *
516  info = 0
517  trans_type = ilatrans( trans )
518  ref_type = int( itref_default )
519  IF ( nparams .GE. la_linrx_itref_i ) THEN
520  IF ( params( la_linrx_itref_i ) .LT. 0.0d+0 ) THEN
521  params( la_linrx_itref_i ) = itref_default
522  ELSE
523  ref_type = params( la_linrx_itref_i )
524  END IF
525  END IF
526 *
527 * Set default parameters.
528 *
529  illrcond_thresh = dble( n ) * dlamch( 'Epsilon' )
530  ithresh = int( ithresh_default )
531  rthresh = rthresh_default
532  unstable_thresh = dzthresh_default
533  ignore_cwise = componentwise_default .EQ. 0.0d+0
534 *
535  IF ( nparams.GE.la_linrx_ithresh_i ) THEN
536  IF ( params( la_linrx_ithresh_i ).LT.0.0d+0 ) THEN
537  params( la_linrx_ithresh_i ) = ithresh
538  ELSE
539  ithresh = int( params( la_linrx_ithresh_i ) )
540  END IF
541  END IF
542  IF ( nparams.GE.la_linrx_cwise_i ) THEN
543  IF ( params( la_linrx_cwise_i ).LT.0.0d+0 ) THEN
544  IF ( ignore_cwise ) THEN
545  params( la_linrx_cwise_i ) = 0.0d+0
546  ELSE
547  params( la_linrx_cwise_i ) = 1.0d+0
548  END IF
549  ELSE
550  ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.0d+0
551  END IF
552  END IF
553  IF ( ref_type .EQ. 0 .OR. n_err_bnds .EQ. 0 ) THEN
554  n_norms = 0
555  ELSE IF ( ignore_cwise ) THEN
556  n_norms = 1
557  ELSE
558  n_norms = 2
559  END IF
560 *
561  notran = lsame( trans, 'N' )
562  rowequ = lsame( equed, 'R' ) .OR. lsame( equed, 'B' )
563  colequ = lsame( equed, 'C' ) .OR. lsame( equed, 'B' )
564 *
565 * Test input parameters.
566 *
567  IF( trans_type.EQ.-1 ) THEN
568  info = -1
569  ELSE IF( .NOT.rowequ .AND. .NOT.colequ .AND.
570  $ .NOT.lsame( equed, 'N' ) ) THEN
571  info = -2
572  ELSE IF( n.LT.0 ) THEN
573  info = -3
574  ELSE IF( kl.LT.0 ) THEN
575  info = -4
576  ELSE IF( ku.LT.0 ) THEN
577  info = -5
578  ELSE IF( nrhs.LT.0 ) THEN
579  info = -6
580  ELSE IF( ldab.LT.kl+ku+1 ) THEN
581  info = -8
582  ELSE IF( ldafb.LT.2*kl+ku+1 ) THEN
583  info = -10
584  ELSE IF( ldb.LT.max( 1, n ) ) THEN
585  info = -13
586  ELSE IF( ldx.LT.max( 1, n ) ) THEN
587  info = -15
588  END IF
589  IF( info.NE.0 ) THEN
590  CALL xerbla( 'DGBRFSX', -info )
591  RETURN
592  END IF
593 *
594 * Quick return if possible.
595 *
596  IF( n.EQ.0 .OR. nrhs.EQ.0 ) THEN
597  rcond = 1.0d+0
598  DO j = 1, nrhs
599  berr( j ) = 0.0d+0
600  IF ( n_err_bnds .GE. 1 ) THEN
601  err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
602  err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
603  END IF
604  IF ( n_err_bnds .GE. 2 ) THEN
605  err_bnds_norm( j, la_linrx_err_i ) = 0.0d+0
606  err_bnds_comp( j, la_linrx_err_i ) = 0.0d+0
607  END IF
608  IF ( n_err_bnds .GE. 3 ) THEN
609  err_bnds_norm( j, la_linrx_rcond_i ) = 1.0d+0
610  err_bnds_comp( j, la_linrx_rcond_i ) = 1.0d+0
611  END IF
612  END DO
613  RETURN
614  END IF
615 *
616 * Default to failure.
617 *
618  rcond = 0.0d+0
619  DO j = 1, nrhs
620  berr( j ) = 1.0d+0
621  IF ( n_err_bnds .GE. 1 ) THEN
622  err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
623  err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
624  END IF
625  IF ( n_err_bnds .GE. 2 ) THEN
626  err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
627  err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
628  END IF
629  IF ( n_err_bnds .GE. 3 ) THEN
630  err_bnds_norm( j, la_linrx_rcond_i ) = 0.0d+0
631  err_bnds_comp( j, la_linrx_rcond_i ) = 0.0d+0
632  END IF
633  END DO
634 *
635 * Compute the norm of A and the reciprocal of the condition
636 * number of A.
637 *
638  IF( notran ) THEN
639  norm = 'I'
640  ELSE
641  norm = '1'
642  END IF
643  anorm = dlangb( norm, n, kl, ku, ab, ldab, work )
644  CALL dgbcon( norm, n, kl, ku, afb, ldafb, ipiv, anorm, rcond,
645  $ work, iwork, info )
646 *
647 * Perform refinement on each right-hand side
648 *
649  IF (ref_type .NE. 0) THEN
650 
651  prec_type = ilaprec( 'E' )
652 
653  IF ( notran ) THEN
654  CALL dla_gbrfsx_extended( prec_type, trans_type, n, kl, ku,
655  $ nrhs, ab, ldab, afb, ldafb, ipiv, colequ, c, b,
656  $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
657  $ err_bnds_comp, work( n+1 ), work( 1 ), work( 2*n+1 ),
658  $ work( 1 ), rcond, ithresh, rthresh, unstable_thresh,
659  $ ignore_cwise, info )
660  ELSE
661  CALL dla_gbrfsx_extended( prec_type, trans_type, n, kl, ku,
662  $ nrhs, ab, ldab, afb, ldafb, ipiv, rowequ, r, b,
663  $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
664  $ err_bnds_comp, work( n+1 ), work( 1 ), work( 2*n+1 ),
665  $ work( 1 ), rcond, ithresh, rthresh, unstable_thresh,
666  $ ignore_cwise, info )
667  END IF
668  END IF
669 
670  err_lbnd = max( 10.0d+0, sqrt( dble( n ) ) ) * dlamch( 'Epsilon' )
671  IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 1 ) THEN
672 *
673 * Compute scaled normwise condition number cond(A*C).
674 *
675  IF ( colequ .AND. notran ) THEN
676  rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
677  $ ldafb, ipiv, -1, c, info, work, iwork )
678  ELSE IF ( rowequ .AND. .NOT. notran ) THEN
679  rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
680  $ ldafb, ipiv, -1, r, info, work, iwork )
681  ELSE
682  rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
683  $ ldafb, ipiv, 0, r, info, work, iwork )
684  END IF
685  DO j = 1, nrhs
686 *
687 * Cap the error at 1.0.
688 *
689  IF ( n_err_bnds .GE. la_linrx_err_i
690  $ .AND. err_bnds_norm( j, la_linrx_err_i ) .GT. 1.0d+0 )
691  $ err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
692 *
693 * Threshold the error (see LAWN).
694 *
695  IF ( rcond_tmp .LT. illrcond_thresh ) THEN
696  err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
697  err_bnds_norm( j, la_linrx_trust_i ) = 0.0d+0
698  IF ( info .LE. n ) info = n + j
699  ELSE IF ( err_bnds_norm( j, la_linrx_err_i ) .LT. err_lbnd )
700  $ THEN
701  err_bnds_norm( j, la_linrx_err_i ) = err_lbnd
702  err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
703  END IF
704 *
705 * Save the condition number.
706 *
707  IF ( n_err_bnds .GE. la_linrx_rcond_i ) THEN
708  err_bnds_norm( j, la_linrx_rcond_i ) = rcond_tmp
709  END IF
710 
711  END DO
712  END IF
713 
714  IF (n_err_bnds .GE. 1 .AND. n_norms .GE. 2) THEN
715 *
716 * Compute componentwise condition number cond(A*diag(Y(:,J))) for
717 * each right-hand side using the current solution as an estimate of
718 * the true solution. If the componentwise error estimate is too
719 * large, then the solution is a lousy estimate of truth and the
720 * estimated RCOND may be too optimistic. To avoid misleading users,
721 * the inverse condition number is set to 0.0 when the estimated
722 * cwise error is at least CWISE_WRONG.
723 *
724  cwise_wrong = sqrt( dlamch( 'Epsilon' ) )
725  DO j = 1, nrhs
726  IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
727  $ THEN
728  rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
729  $ ldafb, ipiv, 1, x( 1, j ), info, work, iwork )
730  ELSE
731  rcond_tmp = 0.0d+0
732  END IF
733 *
734 * Cap the error at 1.0.
735 *
736  IF ( n_err_bnds .GE. la_linrx_err_i
737  $ .AND. err_bnds_comp( j, la_linrx_err_i ) .GT. 1.0d+0 )
738  $ err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
739 *
740 * Threshold the error (see LAWN).
741 *
742  IF ( rcond_tmp .LT. illrcond_thresh ) THEN
743  err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
744  err_bnds_comp( j, la_linrx_trust_i ) = 0.0d+0
745  IF ( params( la_linrx_cwise_i ) .EQ. 1.0d+0
746  $ .AND. info.LT.n + j ) info = n + j
747  ELSE IF ( err_bnds_comp( j, la_linrx_err_i )
748  $ .LT. err_lbnd ) THEN
749  err_bnds_comp( j, la_linrx_err_i ) = err_lbnd
750  err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
751  END IF
752 *
753 * Save the condition number.
754 *
755  IF ( n_err_bnds .GE. la_linrx_rcond_i ) THEN
756  err_bnds_comp( j, la_linrx_rcond_i ) = rcond_tmp
757  END IF
758 
759  END DO
760  END IF
761 *
762  RETURN
763 *
764 * End of DGBRFSX
765 *
integer function ilatrans(TRANS)
ILATRANS
Definition: ilatrans.f:60
subroutine dla_gbrfsx_extended(PREC_TYPE, TRANS_TYPE, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT, N_NORMS, ERR_BNDS_NORM, ERR_BNDS_COMP, RES, AYB, DY, Y_TAIL, RCOND, ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)
DLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded...
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dgbcon(NORM, N, KL, KU, AB, LDAB, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
DGBCON
Definition: dgbcon.f:148
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
integer function ilaprec(PREC)
ILAPREC
Definition: ilaprec.f:60
double precision function dla_gbrcond(TRANS, N, KL, KU, AB, LDAB, AFB, LDAFB, IPIV, CMODE, C, INFO, WORK, IWORK)
DLA_GBRCOND estimates the Skeel condition number for a general banded matrix.
Definition: dla_gbrcond.f:172
double precision function dlangb(NORM, N, KL, KU, AB, LDAB, WORK)
DLANGB returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: dlangb.f:126

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbtf2 ( integer  M,
integer  N,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
integer, dimension( * )  IPIV,
integer  INFO 
)

DGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algorithm.

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

Purpose:
 DGBTF2 computes an LU factorization of a real m-by-n band matrix A
 using partial pivoting with row interchanges.

 This is the unblocked version of the algorithm, calling Level 2 BLAS.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in,out]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          On entry, the matrix A in band storage, in rows KL+1 to
          2*KL+KU+1; rows 1 to KL of the array need not be set.
          The j-th column of A is stored in the j-th column of the
          array AB as follows:
          AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)

          On exit, details of the factorization: U is stored as an
          upper triangular band matrix with KL+KU superdiagonals in
          rows 1 to KL+KU+1, and the multipliers used during the
          factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
          See below for further details.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= 2*KL+KU+1.
[out]IPIV
          IPIV is INTEGER array, dimension (min(M,N))
          The pivot indices; for 1 <= i <= min(M,N), row i of the
          matrix was interchanged with row IPIV(i).
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -i, the i-th argument had an illegal value
          > 0: if INFO = +i, U(i,i) is exactly zero. The factorization
               has been completed, but the factor U is exactly
               singular, and division by zero will occur if it is used
               to solve a system of equations.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012
Further Details:
  The band storage scheme is illustrated by the following example, when
  M = N = 6, KL = 2, KU = 1:

  On entry:                       On exit:

      *    *    *    +    +    +       *    *    *   u14  u25  u36
      *    *    +    +    +    +       *    *   u13  u24  u35  u46
      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56
     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66
     a21  a32  a43  a54  a65   *      m21  m32  m43  m54  m65   *
     a31  a42  a53  a64   *    *      m31  m42  m53  m64   *    *

  Array elements marked * are not used by the routine; elements marked
  + need not be set on entry, but are required by the routine to store
  elements of U, because of fill-in resulting from the row
  interchanges.

Definition at line 147 of file dgbtf2.f.

147 *
148 * -- LAPACK computational routine (version 3.4.2) --
149 * -- LAPACK is a software package provided by Univ. of Tennessee, --
150 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
151 * September 2012
152 *
153 * .. Scalar Arguments ..
154  INTEGER info, kl, ku, ldab, m, n
155 * ..
156 * .. Array Arguments ..
157  INTEGER ipiv( * )
158  DOUBLE PRECISION ab( ldab, * )
159 * ..
160 *
161 * =====================================================================
162 *
163 * .. Parameters ..
164  DOUBLE PRECISION one, zero
165  parameter( one = 1.0d+0, zero = 0.0d+0 )
166 * ..
167 * .. Local Scalars ..
168  INTEGER i, j, jp, ju, km, kv
169 * ..
170 * .. External Functions ..
171  INTEGER idamax
172  EXTERNAL idamax
173 * ..
174 * .. External Subroutines ..
175  EXTERNAL dger, dscal, dswap, xerbla
176 * ..
177 * .. Intrinsic Functions ..
178  INTRINSIC max, min
179 * ..
180 * .. Executable Statements ..
181 *
182 * KV is the number of superdiagonals in the factor U, allowing for
183 * fill-in.
184 *
185  kv = ku + kl
186 *
187 * Test the input parameters.
188 *
189  info = 0
190  IF( m.LT.0 ) THEN
191  info = -1
192  ELSE IF( n.LT.0 ) THEN
193  info = -2
194  ELSE IF( kl.LT.0 ) THEN
195  info = -3
196  ELSE IF( ku.LT.0 ) THEN
197  info = -4
198  ELSE IF( ldab.LT.kl+kv+1 ) THEN
199  info = -6
200  END IF
201  IF( info.NE.0 ) THEN
202  CALL xerbla( 'DGBTF2', -info )
203  RETURN
204  END IF
205 *
206 * Quick return if possible
207 *
208  IF( m.EQ.0 .OR. n.EQ.0 )
209  $ RETURN
210 *
211 * Gaussian elimination with partial pivoting
212 *
213 * Set fill-in elements in columns KU+2 to KV to zero.
214 *
215  DO 20 j = ku + 2, min( kv, n )
216  DO 10 i = kv - j + 2, kl
217  ab( i, j ) = zero
218  10 CONTINUE
219  20 CONTINUE
220 *
221 * JU is the index of the last column affected by the current stage
222 * of the factorization.
223 *
224  ju = 1
225 *
226  DO 40 j = 1, min( m, n )
227 *
228 * Set fill-in elements in column J+KV to zero.
229 *
230  IF( j+kv.LE.n ) THEN
231  DO 30 i = 1, kl
232  ab( i, j+kv ) = zero
233  30 CONTINUE
234  END IF
235 *
236 * Find pivot and test for singularity. KM is the number of
237 * subdiagonal elements in the current column.
238 *
239  km = min( kl, m-j )
240  jp = idamax( km+1, ab( kv+1, j ), 1 )
241  ipiv( j ) = jp + j - 1
242  IF( ab( kv+jp, j ).NE.zero ) THEN
243  ju = max( ju, min( j+ku+jp-1, n ) )
244 *
245 * Apply interchange to columns J to JU.
246 *
247  IF( jp.NE.1 )
248  $ CALL dswap( ju-j+1, ab( kv+jp, j ), ldab-1,
249  $ ab( kv+1, j ), ldab-1 )
250 *
251  IF( km.GT.0 ) THEN
252 *
253 * Compute multipliers.
254 *
255  CALL dscal( km, one / ab( kv+1, j ), ab( kv+2, j ), 1 )
256 *
257 * Update trailing submatrix within the band.
258 *
259  IF( ju.GT.j )
260  $ CALL dger( km, ju-j, -one, ab( kv+2, j ), 1,
261  $ ab( kv, j+1 ), ldab-1, ab( kv+1, j+1 ),
262  $ ldab-1 )
263  END IF
264  ELSE
265 *
266 * If pivot is zero, set INFO to the index of the pivot
267 * unless a zero pivot has already been found.
268 *
269  IF( info.EQ.0 )
270  $ info = j
271  END IF
272  40 CONTINUE
273  RETURN
274 *
275 * End of DGBTF2
276 *
subroutine dger(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
DGER
Definition: dger.f:132
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:53
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbtrf ( integer  M,
integer  N,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
integer, dimension( * )  IPIV,
integer  INFO 
)

DGBTRF

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

Purpose:
 DGBTRF computes an LU factorization of a real m-by-n band matrix A
 using partial pivoting with row interchanges.

 This is the blocked version of the algorithm, calling Level 3 BLAS.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in,out]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          On entry, the matrix A in band storage, in rows KL+1 to
          2*KL+KU+1; rows 1 to KL of the array need not be set.
          The j-th column of A is stored in the j-th column of the
          array AB as follows:
          AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)

          On exit, details of the factorization: U is stored as an
          upper triangular band matrix with KL+KU superdiagonals in
          rows 1 to KL+KU+1, and the multipliers used during the
          factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
          See below for further details.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= 2*KL+KU+1.
[out]IPIV
          IPIV is INTEGER array, dimension (min(M,N))
          The pivot indices; for 1 <= i <= min(M,N), row i of the
          matrix was interchanged with row IPIV(i).
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -i, the i-th argument had an illegal value
          > 0: if INFO = +i, U(i,i) is exactly zero. The factorization
               has been completed, but the factor U is exactly
               singular, and division by zero will occur if it is used
               to solve a system of equations.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  The band storage scheme is illustrated by the following example, when
  M = N = 6, KL = 2, KU = 1:

  On entry:                       On exit:

      *    *    *    +    +    +       *    *    *   u14  u25  u36
      *    *    +    +    +    +       *    *   u13  u24  u35  u46
      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56
     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66
     a21  a32  a43  a54  a65   *      m21  m32  m43  m54  m65   *
     a31  a42  a53  a64   *    *      m31  m42  m53  m64   *    *

  Array elements marked * are not used by the routine; elements marked
  + need not be set on entry, but are required by the routine to store
  elements of U because of fill-in resulting from the row interchanges.

Definition at line 146 of file dgbtrf.f.

146 *
147 * -- LAPACK computational routine (version 3.4.0) --
148 * -- LAPACK is a software package provided by Univ. of Tennessee, --
149 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
150 * November 2011
151 *
152 * .. Scalar Arguments ..
153  INTEGER info, kl, ku, ldab, m, n
154 * ..
155 * .. Array Arguments ..
156  INTEGER ipiv( * )
157  DOUBLE PRECISION ab( ldab, * )
158 * ..
159 *
160 * =====================================================================
161 *
162 * .. Parameters ..
163  DOUBLE PRECISION one, zero
164  parameter( one = 1.0d+0, zero = 0.0d+0 )
165  INTEGER nbmax, ldwork
166  parameter( nbmax = 64, ldwork = nbmax+1 )
167 * ..
168 * .. Local Scalars ..
169  INTEGER i, i2, i3, ii, ip, j, j2, j3, jb, jj, jm, jp,
170  $ ju, k2, km, kv, nb, nw
171  DOUBLE PRECISION temp
172 * ..
173 * .. Local Arrays ..
174  DOUBLE PRECISION work13( ldwork, nbmax ),
175  $ work31( ldwork, nbmax )
176 * ..
177 * .. External Functions ..
178  INTEGER idamax, ilaenv
179  EXTERNAL idamax, ilaenv
180 * ..
181 * .. External Subroutines ..
182  EXTERNAL dcopy, dgbtf2, dgemm, dger, dlaswp, dscal,
183  $ dswap, dtrsm, xerbla
184 * ..
185 * .. Intrinsic Functions ..
186  INTRINSIC max, min
187 * ..
188 * .. Executable Statements ..
189 *
190 * KV is the number of superdiagonals in the factor U, allowing for
191 * fill-in
192 *
193  kv = ku + kl
194 *
195 * Test the input parameters.
196 *
197  info = 0
198  IF( m.LT.0 ) THEN
199  info = -1
200  ELSE IF( n.LT.0 ) THEN
201  info = -2
202  ELSE IF( kl.LT.0 ) THEN
203  info = -3
204  ELSE IF( ku.LT.0 ) THEN
205  info = -4
206  ELSE IF( ldab.LT.kl+kv+1 ) THEN
207  info = -6
208  END IF
209  IF( info.NE.0 ) THEN
210  CALL xerbla( 'DGBTRF', -info )
211  RETURN
212  END IF
213 *
214 * Quick return if possible
215 *
216  IF( m.EQ.0 .OR. n.EQ.0 )
217  $ RETURN
218 *
219 * Determine the block size for this environment
220 *
221  nb = ilaenv( 1, 'DGBTRF', ' ', m, n, kl, ku )
222 *
223 * The block size must not exceed the limit set by the size of the
224 * local arrays WORK13 and WORK31.
225 *
226  nb = min( nb, nbmax )
227 *
228  IF( nb.LE.1 .OR. nb.GT.kl ) THEN
229 *
230 * Use unblocked code
231 *
232  CALL dgbtf2( m, n, kl, ku, ab, ldab, ipiv, info )
233  ELSE
234 *
235 * Use blocked code
236 *
237 * Zero the superdiagonal elements of the work array WORK13
238 *
239  DO 20 j = 1, nb
240  DO 10 i = 1, j - 1
241  work13( i, j ) = zero
242  10 CONTINUE
243  20 CONTINUE
244 *
245 * Zero the subdiagonal elements of the work array WORK31
246 *
247  DO 40 j = 1, nb
248  DO 30 i = j + 1, nb
249  work31( i, j ) = zero
250  30 CONTINUE
251  40 CONTINUE
252 *
253 * Gaussian elimination with partial pivoting
254 *
255 * Set fill-in elements in columns KU+2 to KV to zero
256 *
257  DO 60 j = ku + 2, min( kv, n )
258  DO 50 i = kv - j + 2, kl
259  ab( i, j ) = zero
260  50 CONTINUE
261  60 CONTINUE
262 *
263 * JU is the index of the last column affected by the current
264 * stage of the factorization
265 *
266  ju = 1
267 *
268  DO 180 j = 1, min( m, n ), nb
269  jb = min( nb, min( m, n )-j+1 )
270 *
271 * The active part of the matrix is partitioned
272 *
273 * A11 A12 A13
274 * A21 A22 A23
275 * A31 A32 A33
276 *
277 * Here A11, A21 and A31 denote the current block of JB columns
278 * which is about to be factorized. The number of rows in the
279 * partitioning are JB, I2, I3 respectively, and the numbers
280 * of columns are JB, J2, J3. The superdiagonal elements of A13
281 * and the subdiagonal elements of A31 lie outside the band.
282 *
283  i2 = min( kl-jb, m-j-jb+1 )
284  i3 = min( jb, m-j-kl+1 )
285 *
286 * J2 and J3 are computed after JU has been updated.
287 *
288 * Factorize the current block of JB columns
289 *
290  DO 80 jj = j, j + jb - 1
291 *
292 * Set fill-in elements in column JJ+KV to zero
293 *
294  IF( jj+kv.LE.n ) THEN
295  DO 70 i = 1, kl
296  ab( i, jj+kv ) = zero
297  70 CONTINUE
298  END IF
299 *
300 * Find pivot and test for singularity. KM is the number of
301 * subdiagonal elements in the current column.
302 *
303  km = min( kl, m-jj )
304  jp = idamax( km+1, ab( kv+1, jj ), 1 )
305  ipiv( jj ) = jp + jj - j
306  IF( ab( kv+jp, jj ).NE.zero ) THEN
307  ju = max( ju, min( jj+ku+jp-1, n ) )
308  IF( jp.NE.1 ) THEN
309 *
310 * Apply interchange to columns J to J+JB-1
311 *
312  IF( jp+jj-1.LT.j+kl ) THEN
313 *
314  CALL dswap( jb, ab( kv+1+jj-j, j ), ldab-1,
315  $ ab( kv+jp+jj-j, j ), ldab-1 )
316  ELSE
317 *
318 * The interchange affects columns J to JJ-1 of A31
319 * which are stored in the work array WORK31
320 *
321  CALL dswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
322  $ work31( jp+jj-j-kl, 1 ), ldwork )
323  CALL dswap( j+jb-jj, ab( kv+1, jj ), ldab-1,
324  $ ab( kv+jp, jj ), ldab-1 )
325  END IF
326  END IF
327 *
328 * Compute multipliers
329 *
330  CALL dscal( km, one / ab( kv+1, jj ), ab( kv+2, jj ),
331  $ 1 )
332 *
333 * Update trailing submatrix within the band and within
334 * the current block. JM is the index of the last column
335 * which needs to be updated.
336 *
337  jm = min( ju, j+jb-1 )
338  IF( jm.GT.jj )
339  $ CALL dger( km, jm-jj, -one, ab( kv+2, jj ), 1,
340  $ ab( kv, jj+1 ), ldab-1,
341  $ ab( kv+1, jj+1 ), ldab-1 )
342  ELSE
343 *
344 * If pivot is zero, set INFO to the index of the pivot
345 * unless a zero pivot has already been found.
346 *
347  IF( info.EQ.0 )
348  $ info = jj
349  END IF
350 *
351 * Copy current column of A31 into the work array WORK31
352 *
353  nw = min( jj-j+1, i3 )
354  IF( nw.GT.0 )
355  $ CALL dcopy( nw, ab( kv+kl+1-jj+j, jj ), 1,
356  $ work31( 1, jj-j+1 ), 1 )
357  80 CONTINUE
358  IF( j+jb.LE.n ) THEN
359 *
360 * Apply the row interchanges to the other blocks.
361 *
362  j2 = min( ju-j+1, kv ) - jb
363  j3 = max( 0, ju-j-kv+1 )
364 *
365 * Use DLASWP to apply the row interchanges to A12, A22, and
366 * A32.
367 *
368  CALL dlaswp( j2, ab( kv+1-jb, j+jb ), ldab-1, 1, jb,
369  $ ipiv( j ), 1 )
370 *
371 * Adjust the pivot indices.
372 *
373  DO 90 i = j, j + jb - 1
374  ipiv( i ) = ipiv( i ) + j - 1
375  90 CONTINUE
376 *
377 * Apply the row interchanges to A13, A23, and A33
378 * columnwise.
379 *
380  k2 = j - 1 + jb + j2
381  DO 110 i = 1, j3
382  jj = k2 + i
383  DO 100 ii = j + i - 1, j + jb - 1
384  ip = ipiv( ii )
385  IF( ip.NE.ii ) THEN
386  temp = ab( kv+1+ii-jj, jj )
387  ab( kv+1+ii-jj, jj ) = ab( kv+1+ip-jj, jj )
388  ab( kv+1+ip-jj, jj ) = temp
389  END IF
390  100 CONTINUE
391  110 CONTINUE
392 *
393 * Update the relevant part of the trailing submatrix
394 *
395  IF( j2.GT.0 ) THEN
396 *
397 * Update A12
398 *
399  CALL dtrsm( 'Left', 'Lower', 'No transpose', 'Unit',
400  $ jb, j2, one, ab( kv+1, j ), ldab-1,
401  $ ab( kv+1-jb, j+jb ), ldab-1 )
402 *
403  IF( i2.GT.0 ) THEN
404 *
405 * Update A22
406 *
407  CALL dgemm( 'No transpose', 'No transpose', i2, j2,
408  $ jb, -one, ab( kv+1+jb, j ), ldab-1,
409  $ ab( kv+1-jb, j+jb ), ldab-1, one,
410  $ ab( kv+1, j+jb ), ldab-1 )
411  END IF
412 *
413  IF( i3.GT.0 ) THEN
414 *
415 * Update A32
416 *
417  CALL dgemm( 'No transpose', 'No transpose', i3, j2,
418  $ jb, -one, work31, ldwork,
419  $ ab( kv+1-jb, j+jb ), ldab-1, one,
420  $ ab( kv+kl+1-jb, j+jb ), ldab-1 )
421  END IF
422  END IF
423 *
424  IF( j3.GT.0 ) THEN
425 *
426 * Copy the lower triangle of A13 into the work array
427 * WORK13
428 *
429  DO 130 jj = 1, j3
430  DO 120 ii = jj, jb
431  work13( ii, jj ) = ab( ii-jj+1, jj+j+kv-1 )
432  120 CONTINUE
433  130 CONTINUE
434 *
435 * Update A13 in the work array
436 *
437  CALL dtrsm( 'Left', 'Lower', 'No transpose', 'Unit',
438  $ jb, j3, one, ab( kv+1, j ), ldab-1,
439  $ work13, ldwork )
440 *
441  IF( i2.GT.0 ) THEN
442 *
443 * Update A23
444 *
445  CALL dgemm( 'No transpose', 'No transpose', i2, j3,
446  $ jb, -one, ab( kv+1+jb, j ), ldab-1,
447  $ work13, ldwork, one, ab( 1+jb, j+kv ),
448  $ ldab-1 )
449  END IF
450 *
451  IF( i3.GT.0 ) THEN
452 *
453 * Update A33
454 *
455  CALL dgemm( 'No transpose', 'No transpose', i3, j3,
456  $ jb, -one, work31, ldwork, work13,
457  $ ldwork, one, ab( 1+kl, j+kv ), ldab-1 )
458  END IF
459 *
460 * Copy the lower triangle of A13 back into place
461 *
462  DO 150 jj = 1, j3
463  DO 140 ii = jj, jb
464  ab( ii-jj+1, jj+j+kv-1 ) = work13( ii, jj )
465  140 CONTINUE
466  150 CONTINUE
467  END IF
468  ELSE
469 *
470 * Adjust the pivot indices.
471 *
472  DO 160 i = j, j + jb - 1
473  ipiv( i ) = ipiv( i ) + j - 1
474  160 CONTINUE
475  END IF
476 *
477 * Partially undo the interchanges in the current block to
478 * restore the upper triangular form of A31 and copy the upper
479 * triangle of A31 back into place
480 *
481  DO 170 jj = j + jb - 1, j, -1
482  jp = ipiv( jj ) - jj + 1
483  IF( jp.NE.1 ) THEN
484 *
485 * Apply interchange to columns J to JJ-1
486 *
487  IF( jp+jj-1.LT.j+kl ) THEN
488 *
489 * The interchange does not affect A31
490 *
491  CALL dswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
492  $ ab( kv+jp+jj-j, j ), ldab-1 )
493  ELSE
494 *
495 * The interchange does affect A31
496 *
497  CALL dswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
498  $ work31( jp+jj-j-kl, 1 ), ldwork )
499  END IF
500  END IF
501 *
502 * Copy the current column of A31 back into place
503 *
504  nw = min( i3, jj-j+1 )
505  IF( nw.GT.0 )
506  $ CALL dcopy( nw, work31( 1, jj-j+1 ), 1,
507  $ ab( kv+kl+1-jj+j, jj ), 1 )
508  170 CONTINUE
509  180 CONTINUE
510  END IF
511 *
512  RETURN
513 *
514 * End of DGBTRF
515 *
subroutine dger(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
DGER
Definition: dger.f:132
subroutine dlaswp(N, A, LDA, K1, K2, IPIV, INCX)
DLASWP performs a series of row interchanges on a general rectangular matrix.
Definition: dlaswp.f:116
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:53
subroutine dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
DGEMM
Definition: dgemm.f:189
subroutine dgbtf2(M, N, KL, KU, AB, LDAB, IPIV, INFO)
DGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algo...
Definition: dgbtf2.f:147
subroutine dtrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
DTRSM
Definition: dtrsm.f:183
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:55
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:53

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dgbtrs ( character  TRANS,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
integer, dimension( * )  IPIV,
double precision, dimension( ldb, * )  B,
integer  LDB,
integer  INFO 
)

DGBTRS

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

Purpose:
 DGBTRS solves a system of linear equations
    A * X = B  or  A**T * X = B
 with a general band matrix A using the LU factorization computed
 by DGBTRF.
Parameters
[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**T* X = B  (Conjugate transpose = Transpose)
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]KL
          KL is INTEGER
          The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
          The number of superdiagonals within the band of A.  KU >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of right hand sides, i.e., the number of columns
          of the matrix B.  NRHS >= 0.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          Details of the LU factorization of the band matrix A, as
          computed by DGBTRF.  U is stored as an upper triangular band
          matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
          the multipliers used during the factorization are stored in
          rows KL+KU+2 to 2*KL+KU+1.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= 2*KL+KU+1.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
          The pivot indices; for 1 <= i <= N, row i of the matrix was
          interchanged with row IPIV(i).
[in,out]B
          B is DOUBLE PRECISION array, dimension (LDB,NRHS)
          On entry, the right hand side matrix B.
          On exit, the solution matrix X.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0: if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 140 of file dgbtrs.f.

140 *
141 * -- LAPACK computational routine (version 3.4.0) --
142 * -- LAPACK is a software package provided by Univ. of Tennessee, --
143 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
144 * November 2011
145 *
146 * .. Scalar Arguments ..
147  CHARACTER trans
148  INTEGER info, kl, ku, ldab, ldb, n, nrhs
149 * ..
150 * .. Array Arguments ..
151  INTEGER ipiv( * )
152  DOUBLE PRECISION ab( ldab, * ), b( ldb, * )
153 * ..
154 *
155 * =====================================================================
156 *
157 * .. Parameters ..
158  DOUBLE PRECISION one
159  parameter( one = 1.0d+0 )
160 * ..
161 * .. Local Scalars ..
162  LOGICAL lnoti, notran
163  INTEGER i, j, kd, l, lm
164 * ..
165 * .. External Functions ..
166  LOGICAL lsame
167  EXTERNAL lsame
168 * ..
169 * .. External Subroutines ..
170  EXTERNAL dgemv, dger, dswap, dtbsv, xerbla
171 * ..
172 * .. Intrinsic Functions ..
173  INTRINSIC max, min
174 * ..
175 * .. Executable Statements ..
176 *
177 * Test the input parameters.
178 *
179  info = 0
180  notran = lsame( trans, 'N' )
181  IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
182  $ lsame( trans, 'C' ) ) THEN
183  info = -1
184  ELSE IF( n.LT.0 ) THEN
185  info = -2
186  ELSE IF( kl.LT.0 ) THEN
187  info = -3
188  ELSE IF( ku.LT.0 ) THEN
189  info = -4
190  ELSE IF( nrhs.LT.0 ) THEN
191  info = -5
192  ELSE IF( ldab.LT.( 2*kl+ku+1 ) ) THEN
193  info = -7
194  ELSE IF( ldb.LT.max( 1, n ) ) THEN
195  info = -10
196  END IF
197  IF( info.NE.0 ) THEN
198  CALL xerbla( 'DGBTRS', -info )
199  RETURN
200  END IF
201 *
202 * Quick return if possible
203 *
204  IF( n.EQ.0 .OR. nrhs.EQ.0 )
205  $ RETURN
206 *
207  kd = ku + kl + 1
208  lnoti = kl.GT.0
209 *
210  IF( notran ) THEN
211 *
212 * Solve A*X = B.
213 *
214 * Solve L*X = B, overwriting B with X.
215 *
216 * L is represented as a product of permutations and unit lower
217 * triangular matrices L = P(1) * L(1) * ... * P(n-1) * L(n-1),
218 * where each transformation L(i) is a rank-one modification of
219 * the identity matrix.
220 *
221  IF( lnoti ) THEN
222  DO 10 j = 1, n - 1
223  lm = min( kl, n-j )
224  l = ipiv( j )
225  IF( l.NE.j )
226  $ CALL dswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
227  CALL dger( lm, nrhs, -one, ab( kd+1, j ), 1, b( j, 1 ),
228  $ ldb, b( j+1, 1 ), ldb )
229  10 CONTINUE
230  END IF
231 *
232  DO 20 i = 1, nrhs
233 *
234 * Solve U*X = B, overwriting B with X.
235 *
236  CALL dtbsv( 'Upper', 'No transpose', 'Non-unit', n, kl+ku,
237  $ ab, ldab, b( 1, i ), 1 )
238  20 CONTINUE
239 *
240  ELSE
241 *
242 * Solve A**T*X = B.
243 *
244  DO 30 i = 1, nrhs
245 *
246 * Solve U**T*X = B, overwriting B with X.
247 *
248  CALL dtbsv( 'Upper', 'Transpose', 'Non-unit', n, kl+ku, ab,
249  $ ldab, b( 1, i ), 1 )
250  30 CONTINUE
251 *
252 * Solve L**T*X = B, overwriting B with X.
253 *
254  IF( lnoti ) THEN
255  DO 40 j = n - 1, 1, -1
256  lm = min( kl, n-j )
257  CALL dgemv( 'Transpose', lm, nrhs, -one, b( j+1, 1 ),
258  $ ldb, ab( kd+1, j ), 1, one, b( j, 1 ), ldb )
259  l = ipiv( j )
260  IF( l.NE.j )
261  $ CALL dswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
262  40 CONTINUE
263  END IF
264  END IF
265  RETURN
266 *
267 * End of DGBTRS
268 *
subroutine dger(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
DGER
Definition: dger.f:132
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
DGEMV
Definition: dgemv.f:158
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:53
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dtbsv(UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX)
DTBSV
Definition: dtbsv.f:191

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dggbak ( character  JOB,
character  SIDE,
integer  N,
integer  ILO,
integer  IHI,
double precision, dimension( * )  LSCALE,
double precision, dimension( * )  RSCALE,
integer  M,
double precision, dimension( ldv, * )  V,
integer  LDV,
integer  INFO 
)

DGGBAK

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

Purpose:
 DGGBAK forms the right or left eigenvectors of a real generalized
 eigenvalue problem A*x = lambda*B*x, by backward transformation on
 the computed eigenvectors of the balanced pair of matrices output by
 DGGBAL.
Parameters
[in]JOB
          JOB is CHARACTER*1
          Specifies the type of backward transformation required:
          = 'N':  do nothing, return immediately;
          = 'P':  do backward transformation for permutation only;
          = 'S':  do backward transformation for scaling only;
          = 'B':  do backward transformations for both permutation and
                  scaling.
          JOB must be the same as the argument JOB supplied to DGGBAL.
[in]SIDE
          SIDE is CHARACTER*1
          = 'R':  V contains right eigenvectors;
          = 'L':  V contains left eigenvectors.
[in]N
          N is INTEGER
          The number of rows of the matrix V.  N >= 0.
[in]ILO
          ILO is INTEGER
[in]IHI
          IHI is INTEGER
          The integers ILO and IHI determined by DGGBAL.
          1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
[in]LSCALE
          LSCALE is DOUBLE PRECISION array, dimension (N)
          Details of the permutations and/or scaling factors applied
          to the left side of A and B, as returned by DGGBAL.
[in]RSCALE
          RSCALE is DOUBLE PRECISION array, dimension (N)
          Details of the permutations and/or scaling factors applied
          to the right side of A and B, as returned by DGGBAL.
[in]M
          M is INTEGER
          The number of columns of the matrix V.  M >= 0.
[in,out]V
          V is DOUBLE PRECISION array, dimension (LDV,M)
          On entry, the matrix of right or left eigenvectors to be
          transformed, as returned by DTGEVC.
          On exit, V is overwritten by the transformed eigenvectors.
[in]LDV
          LDV is INTEGER
          The leading dimension of the matrix V. LDV >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0:  successful exit.
          < 0:  if INFO = -i, the i-th argument had an illegal value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2015
Further Details:
  See R.C. Ward, Balancing the generalized eigenvalue problem,
                 SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.

Definition at line 149 of file dggbak.f.

149 *
150 * -- LAPACK computational routine (version 3.6.0) --
151 * -- LAPACK is a software package provided by Univ. of Tennessee, --
152 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153 * November 2015
154 *
155 * .. Scalar Arguments ..
156  CHARACTER job, side
157  INTEGER ihi, ilo, info, ldv, m, n
158 * ..
159 * .. Array Arguments ..
160  DOUBLE PRECISION lscale( * ), rscale( * ), v( ldv, * )
161 * ..
162 *
163 * =====================================================================
164 *
165 * .. Local Scalars ..
166  LOGICAL leftv, rightv
167  INTEGER i, k
168 * ..
169 * .. External Functions ..
170  LOGICAL lsame
171  EXTERNAL lsame
172 * ..
173 * .. External Subroutines ..
174  EXTERNAL dscal, dswap, xerbla
175 * ..
176 * .. Intrinsic Functions ..
177  INTRINSIC max, int
178 * ..
179 * .. Executable Statements ..
180 *
181 * Test the input parameters
182 *
183  rightv = lsame( side, 'R' )
184  leftv = lsame( side, 'L' )
185 *
186  info = 0
187  IF( .NOT.lsame( job, 'N' ) .AND. .NOT.lsame( job, 'P' ) .AND.
188  $ .NOT.lsame( job, 'S' ) .AND. .NOT.lsame( job, 'B' ) ) THEN
189  info = -1
190  ELSE IF( .NOT.rightv .AND. .NOT.leftv ) THEN
191  info = -2
192  ELSE IF( n.LT.0 ) THEN
193  info = -3
194  ELSE IF( ilo.LT.1 ) THEN
195  info = -4
196  ELSE IF( n.EQ.0 .AND. ihi.EQ.0 .AND. ilo.NE.1 ) THEN
197  info = -4
198  ELSE IF( n.GT.0 .AND. ( ihi.LT.ilo .OR. ihi.GT.max( 1, n ) ) )
199  $ THEN
200  info = -5
201  ELSE IF( n.EQ.0 .AND. ilo.EQ.1 .AND. ihi.NE.0 ) THEN
202  info = -5
203  ELSE IF( m.LT.0 ) THEN
204  info = -8
205  ELSE IF( ldv.LT.max( 1, n ) ) THEN
206  info = -10
207  END IF
208  IF( info.NE.0 ) THEN
209  CALL xerbla( 'DGGBAK', -info )
210  RETURN
211  END IF
212 *
213 * Quick return if possible
214 *
215  IF( n.EQ.0 )
216  $ RETURN
217  IF( m.EQ.0 )
218  $ RETURN
219  IF( lsame( job, 'N' ) )
220  $ RETURN
221 *
222  IF( ilo.EQ.ihi )
223  $ GO TO 30
224 *
225 * Backward balance
226 *
227  IF( lsame( job, 'S' ) .OR. lsame( job, 'B' ) ) THEN
228 *
229 * Backward transformation on right eigenvectors
230 *
231  IF( rightv ) THEN
232  DO 10 i = ilo, ihi
233  CALL dscal( m, rscale( i ), v( i, 1 ), ldv )
234  10 CONTINUE
235  END IF
236 *
237 * Backward transformation on left eigenvectors
238 *
239  IF( leftv ) THEN
240  DO 20 i = ilo, ihi
241  CALL dscal( m, lscale( i ), v( i, 1 ), ldv )
242  20 CONTINUE
243  END IF
244  END IF
245 *
246 * Backward permutation
247 *
248  30 CONTINUE
249  IF( lsame( job, 'P' ) .OR. lsame( job, 'B' ) ) THEN
250 *
251 * Backward permutation on right eigenvectors
252 *
253  IF( rightv ) THEN
254  IF( ilo.EQ.1 )
255  $ GO TO 50
256 *
257  DO 40 i = ilo - 1, 1, -1
258  k = int(rscale( i ))
259  IF( k.EQ.i )
260  $ GO TO 40
261  CALL dswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
262  40 CONTINUE
263 *
264  50 CONTINUE
265  IF( ihi.EQ.n )
266  $ GO TO 70
267  DO 60 i = ihi + 1, n
268  k = int(rscale( i ))
269  IF( k.EQ.i )
270  $ GO TO 60
271  CALL dswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
272  60 CONTINUE
273  END IF
274 *
275 * Backward permutation on left eigenvectors
276 *
277  70 CONTINUE
278  IF( leftv ) THEN
279  IF( ilo.EQ.1 )
280  $ GO TO 90
281  DO 80 i = ilo - 1, 1, -1
282  k = int(lscale( i ))
283  IF( k.EQ.i )
284  $ GO TO 80
285  CALL dswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
286  80 CONTINUE
287 *
288  90 CONTINUE
289  IF( ihi.EQ.n )
290  $ GO TO 110
291  DO 100 i = ihi + 1, n
292  k = int(lscale( i ))
293  IF( k.EQ.i )
294  $ GO TO 100
295  CALL dswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
296  100 CONTINUE
297  END IF
298  END IF
299 *
300  110 CONTINUE
301 *
302  RETURN
303 *
304 * End of DGGBAK
305 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:53
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dggbal ( character  JOB,
integer  N,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( ldb, * )  B,
integer  LDB,
integer  ILO,
integer  IHI,
double precision, dimension( * )  LSCALE,
double precision, dimension( * )  RSCALE,
double precision, dimension( * )  WORK,
integer  INFO 
)

DGGBAL

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

Purpose:
 DGGBAL balances a pair of general real matrices (A,B).  This
 involves, first, permuting A and B by similarity transformations to
 isolate eigenvalues in the first 1 to ILO$-$1 and last IHI+1 to N
 elements on the diagonal; and second, applying a diagonal similarity
 transformation to rows and columns ILO to IHI to make the rows
 and columns as close in norm as possible. Both steps are optional.

 Balancing may reduce the 1-norm of the matrices, and improve the
 accuracy of the computed eigenvalues and/or eigenvectors in the
 generalized eigenvalue problem A*x = lambda*B*x.
Parameters
[in]JOB
          JOB is CHARACTER*1
          Specifies the operations to be performed on A and B:
          = 'N':  none:  simply set ILO = 1, IHI = N, LSCALE(I) = 1.0
                  and RSCALE(I) = 1.0 for i = 1,...,N.
          = 'P':  permute only;
          = 'S':  scale only;
          = 'B':  both permute and scale.
[in]N
          N is INTEGER
          The order of the matrices A and B.  N >= 0.
[in,out]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the input matrix A.
          On exit,  A is overwritten by the balanced matrix.
          If JOB = 'N', A is not referenced.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A. LDA >= max(1,N).
[in,out]B
          B is DOUBLE PRECISION array, dimension (LDB,N)
          On entry, the input matrix B.
          On exit,  B is overwritten by the balanced matrix.
          If JOB = 'N', B is not referenced.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B. LDB >= max(1,N).
[out]ILO
          ILO is INTEGER
[out]IHI
          IHI is INTEGER
          ILO and IHI are set to integers such that on exit
          A(i,j) = 0 and B(i,j) = 0 if i > j and
          j = 1,...,ILO-1 or i = IHI+1,...,N.
          If JOB = 'N' or 'S', ILO = 1 and IHI = N.
[out]LSCALE
          LSCALE is DOUBLE PRECISION array, dimension (N)
          Details of the permutations and scaling factors applied
          to the left side of A and B.  If P(j) is the index of the
          row interchanged with row j, and D(j)
          is the scaling factor applied to row j, then
            LSCALE(j) = P(j)    for J = 1,...,ILO-1
                      = D(j)    for J = ILO,...,IHI
                      = P(j)    for J = IHI+1,...,N.
          The order in which the interchanges are made is N to IHI+1,
          then 1 to ILO-1.
[out]RSCALE
          RSCALE is DOUBLE PRECISION array, dimension (N)
          Details of the permutations and scaling factors applied
          to the right side of A and B.  If P(j) is the index of the
          column interchanged with column j, and D(j)
          is the scaling factor applied to column j, then
            LSCALE(j) = P(j)    for J = 1,...,ILO-1
                      = D(j)    for J = ILO,...,IHI
                      = P(j)    for J = IHI+1,...,N.
          The order in which the interchanges are made is N to IHI+1,
          then 1 to ILO-1.
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (lwork)
          lwork must be at least max(1,6*N) when JOB = 'S' or 'B', and
          at least 1 when JOB = 'N' or 'P'.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2015
Further Details:
  See R.C. WARD, Balancing the generalized eigenvalue problem,
                 SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.

Definition at line 179 of file dggbal.f.

179 *
180 * -- LAPACK computational routine (version 3.6.0) --
181 * -- LAPACK is a software package provided by Univ. of Tennessee, --
182 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
183 * November 2015
184 *
185 * .. Scalar Arguments ..
186  CHARACTER job
187  INTEGER ihi, ilo, info, lda, ldb, n
188 * ..
189 * .. Array Arguments ..
190  DOUBLE PRECISION a( lda, * ), b( ldb, * ), lscale( * ),
191  $ rscale( * ), work( * )
192 * ..
193 *
194 * =====================================================================
195 *
196 * .. Parameters ..
197  DOUBLE PRECISION zero, half, one
198  parameter( zero = 0.0d+0, half = 0.5d+0, one = 1.0d+0 )
199  DOUBLE PRECISION three, sclfac
200  parameter( three = 3.0d+0, sclfac = 1.0d+1 )
201 * ..
202 * .. Local Scalars ..
203  INTEGER i, icab, iflow, ip1, ir, irab, it, j, jc, jp1,
204  $ k, kount, l, lcab, lm1, lrab, lsfmax, lsfmin,
205  $ m, nr, nrp2
206  DOUBLE PRECISION alpha, basl, beta, cab, cmax, coef, coef2,
207  $ coef5, cor, ew, ewc, gamma, pgamma, rab, sfmax,
208  $ sfmin, sum, t, ta, tb, tc
209 * ..
210 * .. External Functions ..
211  LOGICAL lsame
212  INTEGER idamax
213  DOUBLE PRECISION ddot, dlamch
214  EXTERNAL lsame, idamax, ddot, dlamch
215 * ..
216 * .. External Subroutines ..
217  EXTERNAL daxpy, dscal, dswap, xerbla
218 * ..
219 * .. Intrinsic Functions ..
220  INTRINSIC abs, dble, int, log10, max, min, sign
221 * ..
222 * .. Executable Statements ..
223 *
224 * Test the input parameters
225 *
226  info = 0
227  IF( .NOT.lsame( job, 'N' ) .AND. .NOT.lsame( job, 'P' ) .AND.
228  $ .NOT.lsame( job, 'S' ) .AND. .NOT.lsame( job, 'B' ) ) THEN
229  info = -1
230  ELSE IF( n.LT.0 ) THEN
231  info = -2
232  ELSE IF( lda.LT.max( 1, n ) ) THEN
233  info = -4
234  ELSE IF( ldb.LT.max( 1, n ) ) THEN
235  info = -6
236  END IF
237  IF( info.NE.0 ) THEN
238  CALL xerbla( 'DGGBAL', -info )
239  RETURN
240  END IF
241 *
242 * Quick return if possible
243 *
244  IF( n.EQ.0 ) THEN
245  ilo = 1
246  ihi = n
247  RETURN
248  END IF
249 *
250  IF( n.EQ.1 ) THEN
251  ilo = 1
252  ihi = n
253  lscale( 1 ) = one
254  rscale( 1 ) = one
255  RETURN
256  END IF
257 *
258  IF( lsame( job, 'N' ) ) THEN
259  ilo = 1
260  ihi = n
261  DO 10 i = 1, n
262  lscale( i ) = one
263  rscale( i ) = one
264  10 CONTINUE
265  RETURN
266  END IF
267 *
268  k = 1
269  l = n
270  IF( lsame( job, 'S' ) )
271  $ GO TO 190
272 *
273  GO TO 30
274 *
275 * Permute the matrices A and B to isolate the eigenvalues.
276 *
277 * Find row with one nonzero in columns 1 through L
278 *
279  20 CONTINUE
280  l = lm1
281  IF( l.NE.1 )
282  $ GO TO 30
283 *
284  rscale( 1 ) = one
285  lscale( 1 ) = one
286  GO TO 190
287 *
288  30 CONTINUE
289  lm1 = l - 1
290  DO 80 i = l, 1, -1
291  DO 40 j = 1, lm1
292  jp1 = j + 1
293  IF( a( i, j ).NE.zero .OR. b( i, j ).NE.zero )
294  $ GO TO 50
295  40 CONTINUE
296  j = l
297  GO TO 70
298 *
299  50 CONTINUE
300  DO 60 j = jp1, l
301  IF( a( i, j ).NE.zero .OR. b( i, j ).NE.zero )
302  $ GO TO 80
303  60 CONTINUE
304  j = jp1 - 1
305 *
306  70 CONTINUE
307  m = l
308  iflow = 1
309  GO TO 160
310  80 CONTINUE
311  GO TO 100
312 *
313 * Find column with one nonzero in rows K through N
314 *
315  90 CONTINUE
316  k = k + 1
317 *
318  100 CONTINUE
319  DO 150 j = k, l
320  DO 110 i = k, lm1
321  ip1 = i + 1
322  IF( a( i, j ).NE.zero .OR. b( i, j ).NE.zero )
323  $ GO TO 120
324  110 CONTINUE
325  i = l
326  GO TO 140
327  120 CONTINUE
328  DO 130 i = ip1, l
329  IF( a( i, j ).NE.zero .OR. b( i, j ).NE.zero )
330  $ GO TO 150
331  130 CONTINUE
332  i = ip1 - 1
333  140 CONTINUE
334  m = k
335  iflow = 2
336  GO TO 160
337  150 CONTINUE
338  GO TO 190
339 *
340 * Permute rows M and I
341 *
342  160 CONTINUE
343  lscale( m ) = i
344  IF( i.EQ.m )
345  $ GO TO 170
346  CALL dswap( n-k+1, a( i, k ), lda, a( m, k ), lda )
347  CALL dswap( n-k+1, b( i, k ), ldb, b( m, k ), ldb )
348 *
349 * Permute columns M and J
350 *
351  170 CONTINUE
352  rscale( m ) = j
353  IF( j.EQ.m )
354  $ GO TO 180
355  CALL dswap( l, a( 1, j ), 1, a( 1, m ), 1 )
356  CALL dswap( l, b( 1, j ), 1, b( 1, m ), 1 )
357 *
358  180 CONTINUE
359  GO TO ( 20, 90 )iflow
360 *
361  190 CONTINUE
362  ilo = k
363  ihi = l
364 *
365  IF( lsame( job, 'P' ) ) THEN
366  DO 195 i = ilo, ihi
367  lscale( i ) = one
368  rscale( i ) = one
369  195 CONTINUE
370  RETURN
371  END IF
372 *
373  IF( ilo.EQ.ihi )
374  $ RETURN
375 *
376 * Balance the submatrix in rows ILO to IHI.
377 *
378  nr = ihi - ilo + 1
379  DO 200 i = ilo, ihi
380  rscale( i ) = zero
381  lscale( i ) = zero
382 *
383  work( i ) = zero
384  work( i+n ) = zero
385  work( i+2*n ) = zero
386  work( i+3*n ) = zero
387  work( i+4*n ) = zero
388  work( i+5*n ) = zero
389  200 CONTINUE
390 *
391 * Compute right side vector in resulting linear equations
392 *
393  basl = log10( sclfac )
394  DO 240 i = ilo, ihi
395  DO 230 j = ilo, ihi
396  tb = b( i, j )
397  ta = a( i, j )
398  IF( ta.EQ.zero )
399  $ GO TO 210
400  ta = log10( abs( ta ) ) / basl
401  210 CONTINUE
402  IF( tb.EQ.zero )
403  $ GO TO 220
404  tb = log10( abs( tb ) ) / basl
405  220 CONTINUE
406  work( i+4*n ) = work( i+4*n ) - ta - tb
407  work( j+5*n ) = work( j+5*n ) - ta - tb
408  230 CONTINUE
409  240 CONTINUE
410 *
411  coef = one / dble( 2*nr )
412  coef2 = coef*coef
413  coef5 = half*coef2
414  nrp2 = nr + 2
415  beta = zero
416  it = 1
417 *
418 * Start generalized conjugate gradient iteration
419 *
420  250 CONTINUE
421 *
422  gamma = ddot( nr, work( ilo+4*n ), 1, work( ilo+4*n ), 1 ) +
423  $ ddot( nr, work( ilo+5*n ), 1, work( ilo+5*n ), 1 )
424 *
425  ew = zero
426  ewc = zero
427  DO 260 i = ilo, ihi
428  ew = ew + work( i+4*n )
429  ewc = ewc + work( i+5*n )
430  260 CONTINUE
431 *
432  gamma = coef*gamma - coef2*( ew**2+ewc**2 ) - coef5*( ew-ewc )**2
433  IF( gamma.EQ.zero )
434  $ GO TO 350
435  IF( it.NE.1 )
436  $ beta = gamma / pgamma
437  t = coef5*( ewc-three*ew )
438  tc = coef5*( ew-three*ewc )
439 *
440  CALL dscal( nr, beta, work( ilo ), 1 )
441  CALL dscal( nr, beta, work( ilo+n ), 1 )
442 *
443  CALL daxpy( nr, coef, work( ilo+4*n ), 1, work( ilo+n ), 1 )
444  CALL daxpy( nr, coef, work( ilo+5*n ), 1, work( ilo ), 1 )
445 *
446  DO 270 i = ilo, ihi
447  work( i ) = work( i ) + tc
448  work( i+n ) = work( i+n ) + t
449  270 CONTINUE
450 *
451 * Apply matrix to vector
452 *
453  DO 300 i = ilo, ihi
454  kount = 0
455  sum = zero
456  DO 290 j = ilo, ihi
457  IF( a( i, j ).EQ.zero )
458  $ GO TO 280
459  kount = kount + 1
460  sum = sum + work( j )
461  280 CONTINUE
462  IF( b( i, j ).EQ.zero )
463  $ GO TO 290
464  kount = kount + 1
465  sum = sum + work( j )
466  290 CONTINUE
467  work( i+2*n ) = dble( kount )*work( i+n ) + sum
468  300 CONTINUE
469 *
470  DO 330 j = ilo, ihi
471  kount = 0
472  sum = zero
473  DO 320 i = ilo, ihi
474  IF( a( i, j ).EQ.zero )
475  $ GO TO 310
476  kount = kount + 1
477  sum = sum + work( i+n )
478  310 CONTINUE
479  IF( b( i, j ).EQ.zero )
480  $ GO TO 320
481  kount = kount + 1
482  sum = sum + work( i+n )
483  320 CONTINUE
484  work( j+3*n ) = dble( kount )*work( j ) + sum
485  330 CONTINUE
486 *
487  sum = ddot( nr, work( ilo+n ), 1, work( ilo+2*n ), 1 ) +
488  $ ddot( nr, work( ilo ), 1, work( ilo+3*n ), 1 )
489  alpha = gamma / sum
490 *
491 * Determine correction to current iteration
492 *
493  cmax = zero
494  DO 340 i = ilo, ihi
495  cor = alpha*work( i+n )
496  IF( abs( cor ).GT.cmax )
497  $ cmax = abs( cor )
498  lscale( i ) = lscale( i ) + cor
499  cor = alpha*work( i )
500  IF( abs( cor ).GT.cmax )
501  $ cmax = abs( cor )
502  rscale( i ) = rscale( i ) + cor
503  340 CONTINUE
504  IF( cmax.LT.half )
505  $ GO TO 350
506 *
507  CALL daxpy( nr, -alpha, work( ilo+2*n ), 1, work( ilo+4*n ), 1 )
508  CALL daxpy( nr, -alpha, work( ilo+3*n ), 1, work( ilo+5*n ), 1 )
509 *
510  pgamma = gamma
511  it = it + 1
512  IF( it.LE.nrp2 )
513  $ GO TO 250
514 *
515 * End generalized conjugate gradient iteration
516 *
517  350 CONTINUE
518  sfmin = dlamch( 'S' )
519  sfmax = one / sfmin
520  lsfmin = int( log10( sfmin ) / basl+one )
521  lsfmax = int( log10( sfmax ) / basl )
522  DO 360 i = ilo, ihi
523  irab = idamax( n-ilo+1, a( i, ilo ), lda )
524  rab = abs( a( i, irab+ilo-1 ) )
525  irab = idamax( n-ilo+1, b( i, ilo ), ldb )
526  rab = max( rab, abs( b( i, irab+ilo-1 ) ) )
527  lrab = int( log10( rab+sfmin ) / basl+one )
528  ir = int(lscale( i ) + sign( half, lscale( i ) ))
529  ir = min( max( ir, lsfmin ), lsfmax, lsfmax-lrab )
530  lscale( i ) = sclfac**ir
531  icab = idamax( ihi, a( 1, i ), 1 )
532  cab = abs( a( icab, i ) )
533  icab = idamax( ihi, b( 1, i ), 1 )
534  cab = max( cab, abs( b( icab, i ) ) )
535  lcab = int( log10( cab+sfmin ) / basl+one )
536  jc = int(rscale( i ) + sign( half, rscale( i ) ))
537  jc = min( max( jc, lsfmin ), lsfmax, lsfmax-lcab )
538  rscale( i ) = sclfac**jc
539  360 CONTINUE
540 *
541 * Row scaling of matrices A and B
542 *
543  DO 370 i = ilo, ihi
544  CALL dscal( n-ilo+1, lscale( i ), a( i, ilo ), lda )
545  CALL dscal( n-ilo+1, lscale( i ), b( i, ilo ), ldb )
546  370 CONTINUE
547 *
548 * Column scaling of matrices A and B
549 *
550  DO 380 j = ilo, ihi
551  CALL dscal( ihi, rscale( j ), a( 1, j ), 1 )
552  CALL dscal( ihi, rscale( j ), b( 1, j ), 1 )
553  380 CONTINUE
554 *
555  RETURN
556 *
557 * End of DGGBAL
558 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:53
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
double precision function ddot(N, DX, INCX, DY, INCY)
DDOT
Definition: ddot.f:53
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:55
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:54

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dla_gbamv ( integer  TRANS,
integer  M,
integer  N,
integer  KL,
integer  KU,
double precision  ALPHA,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( * )  X,
integer  INCX,
double precision  BETA,
double precision, dimension( * )  Y,
integer  INCY 
)

DLA_GBAMV performs a matrix-vector operation to calculate error bounds.

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

Purpose:
 DLA_GBAMV  performs one of the matrix-vector operations

         y := alpha*abs(A)*abs(x) + beta*abs(y),
    or   y := alpha*abs(A)**T*abs(x) + beta*abs(y),

 where alpha and beta are scalars, x and y are vectors and A is an
 m by n matrix.

 This function is primarily used in calculating error bounds.
 To protect against underflow during evaluation, components in
 the resulting vector are perturbed away from zero by (N+1)
 times the underflow threshold.  To prevent unnecessarily large
 errors for block-structure embedded in general matrices,
 "symbolically" zero components are not perturbed.  A zero
 entry is considered "symbolic" if all multiplications involved
 in computing that entry have at least one zero multiplicand.
Parameters
[in]TRANS
          TRANS is INTEGER
           On entry, TRANS specifies the operation to be performed as
           follows:

             BLAS_NO_TRANS      y := alpha*abs(A)*abs(x) + beta*abs(y)
             BLAS_TRANS         y := alpha*abs(A**T)*abs(x) + beta*abs(y)
             BLAS_CONJ_TRANS    y := alpha*abs(A**T)*abs(x) + beta*abs(y)

           Unchanged on exit.
[in]M
          M is INTEGER
           On entry, M specifies the number of rows of the matrix A.
           M must be at least zero.
           Unchanged on exit.
[in]N
          N is INTEGER
           On entry, N specifies the number of columns of the matrix A.
           N must be at least zero.
           Unchanged on exit.
[in]KL
          KL is INTEGER
           The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
           The number of superdiagonals within the band of A.  KU >= 0.
[in]ALPHA
          ALPHA is DOUBLE PRECISION
           On entry, ALPHA specifies the scalar alpha.
           Unchanged on exit.
[in]AB
          AB is DOUBLE PRECISION array of DIMENSION ( LDAB, n )
           Before entry, the leading m by n part of the array AB must
           contain the matrix of coefficients.
           Unchanged on exit.
[in]LDAB
          LDAB is INTEGER
           On entry, LDA specifies the first dimension of AB as declared
           in the calling (sub) program. LDAB must be at least
           max( 1, m ).
           Unchanged on exit.
[in]X
          X is DOUBLE PRECISION array, dimension
           ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
           and at least
           ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
           Before entry, the incremented array X must contain the
           vector x.
           Unchanged on exit.
[in]INCX
          INCX is INTEGER
           On entry, INCX specifies the increment for the elements of
           X. INCX must not be zero.
           Unchanged on exit.
[in]BETA
          BETA is DOUBLE PRECISION
           On entry, BETA specifies the scalar beta. When BETA is
           supplied as zero then Y need not be set on input.
           Unchanged on exit.
[in,out]Y
          Y is DOUBLE PRECISION array, dimension
           ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
           and at least
           ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
           Before entry with BETA non-zero, the incremented array Y
           must contain the vector y. On exit, Y is overwritten by the
           updated vector y.
[in]INCY
          INCY is INTEGER
           On entry, INCY specifies the increment for the elements of
           Y. INCY must not be zero.
           Unchanged on exit.

  Level 2 Blas routine.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 187 of file dla_gbamv.f.

187 *
188 * -- LAPACK computational routine (version 3.4.2) --
189 * -- LAPACK is a software package provided by Univ. of Tennessee, --
190 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
191 * September 2012
192 *
193 * .. Scalar Arguments ..
194  DOUBLE PRECISION alpha, beta
195  INTEGER incx, incy, ldab, m, n, kl, ku, trans
196 * ..
197 * .. Array Arguments ..
198  DOUBLE PRECISION ab( ldab, * ), x( * ), y( * )
199 * ..
200 *
201 * =====================================================================
202 *
203 * .. Parameters ..
204  DOUBLE PRECISION one, zero
205  parameter( one = 1.0d+0, zero = 0.0d+0 )
206 * ..
207 * .. Local Scalars ..
208  LOGICAL symb_zero
209  DOUBLE PRECISION temp, safe1
210  INTEGER i, info, iy, j, jx, kx, ky, lenx, leny, kd, ke
211 * ..
212 * .. External Subroutines ..
213  EXTERNAL xerbla, dlamch
214  DOUBLE PRECISION dlamch
215 * ..
216 * .. External Functions ..
217  EXTERNAL ilatrans
218  INTEGER ilatrans
219 * ..
220 * .. Intrinsic Functions ..
221  INTRINSIC max, abs, sign
222 * ..
223 * .. Executable Statements ..
224 *
225 * Test the input parameters.
226 *
227  info = 0
228  IF ( .NOT.( ( trans.EQ.ilatrans( 'N' ) )
229  $ .OR. ( trans.EQ.ilatrans( 'T' ) )
230  $ .OR. ( trans.EQ.ilatrans( 'C' ) ) ) ) THEN
231  info = 1
232  ELSE IF( m.LT.0 )THEN
233  info = 2
234  ELSE IF( n.LT.0 )THEN
235  info = 3
236  ELSE IF( kl.LT.0 .OR. kl.GT.m-1 ) THEN
237  info = 4
238  ELSE IF( ku.LT.0 .OR. ku.GT.n-1 ) THEN
239  info = 5
240  ELSE IF( ldab.LT.kl+ku+1 )THEN
241  info = 6
242  ELSE IF( incx.EQ.0 )THEN
243  info = 8
244  ELSE IF( incy.EQ.0 )THEN
245  info = 11
246  END IF
247  IF( info.NE.0 )THEN
248  CALL xerbla( 'DLA_GBAMV ', info )
249  RETURN
250  END IF
251 *
252 * Quick return if possible.
253 *
254  IF( ( m.EQ.0 ).OR.( n.EQ.0 ).OR.
255  $ ( ( alpha.EQ.zero ).AND.( beta.EQ.one ) ) )
256  $ RETURN
257 *
258 * Set LENX and LENY, the lengths of the vectors x and y, and set
259 * up the start points in X and Y.
260 *
261  IF( trans.EQ.ilatrans( 'N' ) )THEN
262  lenx = n
263  leny = m
264  ELSE
265  lenx = m
266  leny = n
267  END IF
268  IF( incx.GT.0 )THEN
269  kx = 1
270  ELSE
271  kx = 1 - ( lenx - 1 )*incx
272  END IF
273  IF( incy.GT.0 )THEN
274  ky = 1
275  ELSE
276  ky = 1 - ( leny - 1 )*incy
277  END IF
278 *
279 * Set SAFE1 essentially to be the underflow threshold times the
280 * number of additions in each row.
281 *
282  safe1 = dlamch( 'Safe minimum' )
283  safe1 = (n+1)*safe1
284 *
285 * Form y := alpha*abs(A)*abs(x) + beta*abs(y).
286 *
287 * The O(M*N) SYMB_ZERO tests could be replaced by O(N) queries to
288 * the inexact flag. Still doesn't help change the iteration order
289 * to per-column.
290 *
291  kd = ku + 1
292  ke = kl + 1
293  iy = ky
294  IF ( incx.EQ.1 ) THEN
295  IF( trans.EQ.ilatrans( 'N' ) )THEN
296  DO i = 1, leny
297  IF ( beta .EQ. zero ) THEN
298  symb_zero = .true.
299  y( iy ) = 0.0d+0
300  ELSE IF ( y( iy ) .EQ. zero ) THEN
301  symb_zero = .true.
302  ELSE
303  symb_zero = .false.
304  y( iy ) = beta * abs( y( iy ) )
305  END IF
306  IF ( alpha .NE. zero ) THEN
307  DO j = max( i-kl, 1 ), min( i+ku, lenx )
308  temp = abs( ab( kd+i-j, j ) )
309  symb_zero = symb_zero .AND.
310  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
311 
312  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
313  END DO
314  END IF
315 
316  IF ( .NOT.symb_zero )
317  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
318  iy = iy + incy
319  END DO
320  ELSE
321  DO i = 1, leny
322  IF ( beta .EQ. zero ) THEN
323  symb_zero = .true.
324  y( iy ) = 0.0d+0
325  ELSE IF ( y( iy ) .EQ. zero ) THEN
326  symb_zero = .true.
327  ELSE
328  symb_zero = .false.
329  y( iy ) = beta * abs( y( iy ) )
330  END IF
331  IF ( alpha .NE. zero ) THEN
332  DO j = max( i-kl, 1 ), min( i+ku, lenx )
333  temp = abs( ab( ke-i+j, i ) )
334  symb_zero = symb_zero .AND.
335  $ ( x( j ) .EQ. zero .OR. temp .EQ. zero )
336 
337  y( iy ) = y( iy ) + alpha*abs( x( j ) )*temp
338  END DO
339  END IF
340 
341  IF ( .NOT.symb_zero )
342  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
343  iy = iy + incy
344  END DO
345  END IF
346  ELSE
347  IF( trans.EQ.ilatrans( 'N' ) )THEN
348  DO i = 1, leny
349  IF ( beta .EQ. zero ) THEN
350  symb_zero = .true.
351  y( iy ) = 0.0d+0
352  ELSE IF ( y( iy ) .EQ. zero ) THEN
353  symb_zero = .true.
354  ELSE
355  symb_zero = .false.
356  y( iy ) = beta * abs( y( iy ) )
357  END IF
358  IF ( alpha .NE. zero ) THEN
359  jx = kx
360  DO j = max( i-kl, 1 ), min( i+ku, lenx )
361  temp = abs( ab( kd+i-j, j ) )
362  symb_zero = symb_zero .AND.
363  $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
364 
365  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
366  jx = jx + incx
367  END DO
368  END IF
369 
370  IF ( .NOT.symb_zero )
371  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
372 
373  iy = iy + incy
374  END DO
375  ELSE
376  DO i = 1, leny
377  IF ( beta .EQ. zero ) THEN
378  symb_zero = .true.
379  y( iy ) = 0.0d+0
380  ELSE IF ( y( iy ) .EQ. zero ) THEN
381  symb_zero = .true.
382  ELSE
383  symb_zero = .false.
384  y( iy ) = beta * abs( y( iy ) )
385  END IF
386  IF ( alpha .NE. zero ) THEN
387  jx = kx
388  DO j = max( i-kl, 1 ), min( i+ku, lenx )
389  temp = abs( ab( ke-i+j, i ) )
390  symb_zero = symb_zero .AND.
391  $ ( x( jx ) .EQ. zero .OR. temp .EQ. zero )
392 
393  y( iy ) = y( iy ) + alpha*abs( x( jx ) )*temp
394  jx = jx + incx
395  END DO
396  END IF
397 
398  IF ( .NOT.symb_zero )
399  $ y( iy ) = y( iy ) + sign( safe1, y( iy ) )
400 
401  iy = iy + incy
402  END DO
403  END IF
404 
405  END IF
406 *
407  RETURN
408 *
409 * End of DLA_GBAMV
410 *
integer function ilatrans(TRANS)
ILATRANS
Definition: ilatrans.f:60
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65

Here is the call graph for this function:

Here is the caller graph for this function:

double precision function dla_gbrcond ( character  TRANS,
integer  N,
integer  KL,
integer  KU,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( ldafb, * )  AFB,
integer  LDAFB,
integer, dimension( * )  IPIV,
integer  CMODE,
double precision, dimension( * )  C,
integer  INFO,
double precision, dimension( * )  WORK,
integer, dimension( * )  IWORK 
)

DLA_GBRCOND estimates the Skeel condition number for a general banded matrix.

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

Purpose:
    DLA_GBRCOND Estimates the Skeel condition number of  op(A) * op2(C)
    where op2 is determined by CMODE as follows
    CMODE =  1    op2(C) = C
    CMODE =  0    op2(C) = I
    CMODE = -1    op2(C) = inv(C)
    The Skeel condition number  cond(A) = norminf( |inv(A)||A| )
    is computed by computing scaling factors R such that
    diag(R)*A*op2(C) is row equilibrated and computing the standard
    infinity-norm condition number.
Parameters
[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]N
          N is INTEGER
     The number of linear equations, i.e., the order of the
     matrix A.  N >= 0.
[in]KL
          KL is INTEGER
     The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
     The number of superdiagonals within the band of A.  KU >= 0.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
     On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
     The j-th column of A is stored in the j-th column of the
     array AB as follows:
     AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
[in]LDAB
          LDAB is INTEGER
     The leading dimension of the array AB.  LDAB >= KL+KU+1.
[in]AFB
          AFB is DOUBLE PRECISION array, dimension (LDAFB,N)
     Details of the LU factorization of the band matrix A, as
     computed by DGBTRF.  U is stored as an upper triangular
     band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
     and the multipliers used during the factorization are stored
     in rows KL+KU+2 to 2*KL+KU+1.
[in]LDAFB
          LDAFB is INTEGER
     The leading dimension of the array AFB.  LDAFB >= 2*KL+KU+1.
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     The pivot indices from the factorization A = P*L*U
     as computed by DGBTRF; row i of the matrix was interchanged
     with row IPIV(i).
[in]CMODE
          CMODE is INTEGER
     Determines op2(C) in the formula op(A) * op2(C) as follows:
     CMODE =  1    op2(C) = C
     CMODE =  0    op2(C) = I
     CMODE = -1    op2(C) = inv(C)
[in]C
          C is DOUBLE PRECISION array, dimension (N)
     The vector C in the formula op(A) * op2(C).
[out]INFO
          INFO is INTEGER
       = 0:  Successful exit.
     i > 0:  The ith argument is invalid.
[in]WORK
          WORK is DOUBLE PRECISION array, dimension (5*N).
     Workspace.
[in]IWORK
          IWORK is INTEGER array, dimension (N).
     Workspace.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 172 of file dla_gbrcond.f.

172 *
173 * -- LAPACK computational routine (version 3.4.2) --
174 * -- LAPACK is a software package provided by Univ. of Tennessee, --
175 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
176 * September 2012
177 *
178 * .. Scalar Arguments ..
179  CHARACTER trans
180  INTEGER n, ldab, ldafb, info, kl, ku, cmode
181 * ..
182 * .. Array Arguments ..
183  INTEGER iwork( * ), ipiv( * )
184  DOUBLE PRECISION ab( ldab, * ), afb( ldafb, * ), work( * ),
185  $ c( * )
186 * ..
187 *
188 * =====================================================================
189 *
190 * .. Local Scalars ..
191  LOGICAL notrans
192  INTEGER kase, i, j, kd, ke
193  DOUBLE PRECISION ainvnm, tmp
194 * ..
195 * .. Local Arrays ..
196  INTEGER isave( 3 )
197 * ..
198 * .. External Functions ..
199  LOGICAL lsame
200  EXTERNAL lsame
201 * ..
202 * .. External Subroutines ..
203  EXTERNAL dlacn2, dgbtrs, xerbla
204 * ..
205 * .. Intrinsic Functions ..
206  INTRINSIC abs, max
207 * ..
208 * .. Executable Statements ..
209 *
210  dla_gbrcond = 0.0d+0
211 *
212  info = 0
213  notrans = lsame( trans, 'N' )
214  IF ( .NOT. notrans .AND. .NOT. lsame(trans, 'T')
215  $ .AND. .NOT. lsame(trans, 'C') ) THEN
216  info = -1
217  ELSE IF( n.LT.0 ) THEN
218  info = -2
219  ELSE IF( kl.LT.0 .OR. kl.GT.n-1 ) THEN
220  info = -3
221  ELSE IF( ku.LT.0 .OR. ku.GT.n-1 ) THEN
222  info = -4
223  ELSE IF( ldab.LT.kl+ku+1 ) THEN
224  info = -6
225  ELSE IF( ldafb.LT.2*kl+ku+1 ) THEN
226  info = -8
227  END IF
228  IF( info.NE.0 ) THEN
229  CALL xerbla( 'DLA_GBRCOND', -info )
230  RETURN
231  END IF
232  IF( n.EQ.0 ) THEN
233  dla_gbrcond = 1.0d+0
234  RETURN
235  END IF
236 *
237 * Compute the equilibration matrix R such that
238 * inv(R)*A*C has unit 1-norm.
239 *
240  kd = ku + 1
241  ke = kl + 1
242  IF ( notrans ) THEN
243  DO i = 1, n
244  tmp = 0.0d+0
245  IF ( cmode .EQ. 1 ) THEN
246  DO j = max( i-kl, 1 ), min( i+ku, n )
247  tmp = tmp + abs( ab( kd+i-j, j ) * c( j ) )
248  END DO
249  ELSE IF ( cmode .EQ. 0 ) THEN
250  DO j = max( i-kl, 1 ), min( i+ku, n )
251  tmp = tmp + abs( ab( kd+i-j, j ) )
252  END DO
253  ELSE
254  DO j = max( i-kl, 1 ), min( i+ku, n )
255  tmp = tmp + abs( ab( kd+i-j, j ) / c( j ) )
256  END DO
257  END IF
258  work( 2*n+i ) = tmp
259  END DO
260  ELSE
261  DO i = 1, n
262  tmp = 0.0d+0
263  IF ( cmode .EQ. 1 ) THEN
264  DO j = max( i-kl, 1 ), min( i+ku, n )
265  tmp = tmp + abs( ab( ke-i+j, i ) * c( j ) )
266  END DO
267  ELSE IF ( cmode .EQ. 0 ) THEN
268  DO j = max( i-kl, 1 ), min( i+ku, n )
269  tmp = tmp + abs( ab( ke-i+j, i ) )
270  END DO
271  ELSE
272  DO j = max( i-kl, 1 ), min( i+ku, n )
273  tmp = tmp + abs( ab( ke-i+j, i ) / c( j ) )
274  END DO
275  END IF
276  work( 2*n+i ) = tmp
277  END DO
278  END IF
279 *
280 * Estimate the norm of inv(op(A)).
281 *
282  ainvnm = 0.0d+0
283 
284  kase = 0
285  10 CONTINUE
286  CALL dlacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
287  IF( kase.NE.0 ) THEN
288  IF( kase.EQ.2 ) THEN
289 *
290 * Multiply by R.
291 *
292  DO i = 1, n
293  work( i ) = work( i ) * work( 2*n+i )
294  END DO
295 
296  IF ( notrans ) THEN
297  CALL dgbtrs( 'No transpose', n, kl, ku, 1, afb, ldafb,
298  $ ipiv, work, n, info )
299  ELSE
300  CALL dgbtrs( 'Transpose', n, kl, ku, 1, afb, ldafb, ipiv,
301  $ work, n, info )
302  END IF
303 *
304 * Multiply by inv(C).
305 *
306  IF ( cmode .EQ. 1 ) THEN
307  DO i = 1, n
308  work( i ) = work( i ) / c( i )
309  END DO
310  ELSE IF ( cmode .EQ. -1 ) THEN
311  DO i = 1, n
312  work( i ) = work( i ) * c( i )
313  END DO
314  END IF
315  ELSE
316 *
317 * Multiply by inv(C**T).
318 *
319  IF ( cmode .EQ. 1 ) THEN
320  DO i = 1, n
321  work( i ) = work( i ) / c( i )
322  END DO
323  ELSE IF ( cmode .EQ. -1 ) THEN
324  DO i = 1, n
325  work( i ) = work( i ) * c( i )
326  END DO
327  END IF
328 
329  IF ( notrans ) THEN
330  CALL dgbtrs( 'Transpose', n, kl, ku, 1, afb, ldafb, ipiv,
331  $ work, n, info )
332  ELSE
333  CALL dgbtrs( 'No transpose', n, kl, ku, 1, afb, ldafb,
334  $ ipiv, work, n, info )
335  END IF
336 *
337 * Multiply by R.
338 *
339  DO i = 1, n
340  work( i ) = work( i ) * work( 2*n+i )
341  END DO
342  END IF
343  GO TO 10
344  END IF
345 *
346 * Compute the estimate of the reciprocal condition number.
347 *
348  IF( ainvnm .NE. 0.0d+0 )
349  $ dla_gbrcond = ( 1.0d+0 / ainvnm )
350 *
351  RETURN
352 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
double precision function dla_gbrcond(TRANS, N, KL, KU, AB, LDAB, AFB, LDAFB, IPIV, CMODE, C, INFO, WORK, IWORK)
DLA_GBRCOND estimates the Skeel condition number for a general banded matrix.
Definition: dla_gbrcond.f:172
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
subroutine dgbtrs(TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
DGBTRS
Definition: dgbtrs.f:140

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine dla_gbrfsx_extended ( integer  PREC_TYPE,
integer  TRANS_TYPE,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( ldafb, * )  AFB,
integer  LDAFB,
integer, dimension( * )  IPIV,
logical  COLEQU,
double precision, dimension( * )  C,
double precision, dimension( ldb, * )  B,
integer  LDB,
double precision, dimension( ldy, * )  Y,
integer  LDY,
double precision, dimension(*)  BERR_OUT,
integer  N_NORMS,
double precision, dimension( nrhs, * )  ERR_BNDS_NORM,
double precision, dimension( nrhs, * )  ERR_BNDS_COMP,
double precision, dimension(*)  RES,
double precision, dimension(*)  AYB,
double precision, dimension(*)  DY,
double precision, dimension(*)  Y_TAIL,
double precision  RCOND,
integer  ITHRESH,
double precision  RTHRESH,
double precision  DZ_UB,
logical  IGNORE_CWISE,
integer  INFO 
)

DLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution.

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

Purpose:
 DLA_GBRFSX_EXTENDED improves the computed solution to a system of
 linear equations by performing extra-precise iterative refinement
 and provides error bounds and backward error estimates for the solution.
 This subroutine is called by DGBRFSX to perform iterative refinement.
 In addition to normwise error bound, the code provides maximum
 componentwise error bound if possible. See comments for ERR_BNDS_NORM
 and ERR_BNDS_COMP for details of the error bounds. Note that this
 subroutine is only resonsible for setting the second fields of
 ERR_BNDS_NORM and ERR_BNDS_COMP.
Parameters
[in]PREC_TYPE
          PREC_TYPE is INTEGER
     Specifies the intermediate precision to be used in refinement.
     The value is defined by ILAPREC(P) where P is a CHARACTER and
     P    = 'S':  Single
          = 'D':  Double
          = 'I':  Indigenous
          = 'X', 'E':  Extra
[in]TRANS_TYPE
          TRANS_TYPE is INTEGER
     Specifies the transposition operation on A.
     The value is defined by ILATRANS(T) where T is a CHARACTER and
     T    = 'N':  No transpose
          = 'T':  Transpose
          = 'C':  Conjugate transpose
[in]N
          N is INTEGER
     The number of linear equations, i.e., the order of the
     matrix A.  N >= 0.
[in]KL
          KL is INTEGER
     The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
     The number of superdiagonals within the band of A.  KU >= 0
[in]NRHS
          NRHS is INTEGER
     The number of right-hand-sides, i.e., the number of columns of the
     matrix B.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
          On entry, the N-by-N matrix AB.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDBA >= max(1,N).
[in]AFB
          AFB is DOUBLE PRECISION array, dimension (LDAFB,N)
     The factors L and U from the factorization
     A = P*L*U as computed by DGBTRF.
[in]LDAFB
          LDAFB is INTEGER
     The leading dimension of the array AF.  LDAFB >= max(1,N).
[in]IPIV
          IPIV is INTEGER array, dimension (N)
     The pivot indices from the factorization A = P*L*U
     as computed by DGBTRF; row i of the matrix was interchanged
     with row IPIV(i).
[in]COLEQU
          COLEQU is LOGICAL
     If .TRUE. then column equilibration was done to A before calling
     this routine. This is needed to compute the solution and error
     bounds correctly.
[in]C
          C is DOUBLE PRECISION array, dimension (N)
     The column scale factors for A. If COLEQU = .FALSE., C
     is not accessed. If C is input, each element of C should be a power
     of the radix to ensure a reliable solution and error estimates.
     Scaling by powers of the radix does not cause rounding errors unless
     the result underflows or overflows. Rounding errors during scaling
     lead to refining with a matrix that is not equivalent to the
     input matrix, producing error estimates that may not be
     reliable.
[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,out]Y
          Y is DOUBLE PRECISION array, dimension
                    (LDY,NRHS)
     On entry, the solution matrix X, as computed by DGBTRS.
     On exit, the improved solution matrix Y.
[in]LDY
          LDY is INTEGER
     The leading dimension of the array Y.  LDY >= max(1,N).
[out]BERR_OUT
          BERR_OUT is DOUBLE PRECISION array, dimension (NRHS)
     On exit, BERR_OUT(j) contains the componentwise relative backward
     error for right-hand-side j from the formula
         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
     where abs(Z) is the componentwise absolute value of the matrix
     or vector Z. This is computed by DLA_LIN_BERR.
[in]N_NORMS
          N_NORMS is INTEGER
     Determines which error bounds to return (see ERR_BNDS_NORM
     and ERR_BNDS_COMP).
     If N_NORMS >= 1 return normwise error bounds.
     If N_NORMS >= 2 return componentwise error bounds.
[in,out]ERR_BNDS_NORM
          ERR_BNDS_NORM is DOUBLE PRECISION array, dimension
                    (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     normwise relative error, which is defined as follows:

     Normwise relative error in the ith solution vector:
             max_j (abs(XTRUE(j,i) - X(j,i)))
            ------------------------------
                  max_j abs(X(j,i))

     The array is indexed by the type of error information as described
     below. There currently are up to three pieces of information
     returned.

     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_NORM(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * slamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * slamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated normwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * slamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*A, where S scales each row by a power of the
              radix so all absolute row sums of Z are approximately 1.

     This subroutine is only responsible for setting the second field
     above.
     See Lapack Working Note 165 for further details and extra
     cautions.
[in,out]ERR_BNDS_COMP
          ERR_BNDS_COMP is DOUBLE PRECISION array, dimension
                    (NRHS, N_ERR_BNDS)
     For each right-hand side, this array contains information about
     various error bounds and condition numbers corresponding to the
     componentwise relative error, which is defined as follows:

     Componentwise relative error in the ith solution vector:
                    abs(XTRUE(j,i) - X(j,i))
             max_j ----------------------
                         abs(X(j,i))

     The array is indexed by the right-hand side i (on which the
     componentwise relative error depends), and the type of error
     information as described below. There currently are up to three
     pieces of information returned for each right-hand side. If
     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
     the first (:,N_ERR_BNDS) entries are returned.

     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
     right-hand side.

     The second index in ERR_BNDS_COMP(:,err) contains the following
     three fields:
     err = 1 "Trust/don't trust" boolean. Trust the answer if the
              reciprocal condition number is less than the threshold
              sqrt(n) * slamch('Epsilon').

     err = 2 "Guaranteed" error bound: The estimated forward error,
              almost certainly within a factor of 10 of the true error
              so long as the next entry is greater than the threshold
              sqrt(n) * slamch('Epsilon'). This error bound should only
              be trusted if the previous boolean is true.

     err = 3  Reciprocal condition number: Estimated componentwise
              reciprocal condition number.  Compared with the threshold
              sqrt(n) * slamch('Epsilon') to determine if the error
              estimate is "guaranteed". These reciprocal condition
              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
              appropriately scaled matrix Z.
              Let Z = S*(A*diag(x)), where x is the solution for the
              current right-hand side and S scales each row of
              A*diag(x) by a power of the radix so all absolute row
              sums of Z are approximately 1.

     This subroutine is only responsible for setting the second field
     above.
     See Lapack Working Note 165 for further details and extra
     cautions.
[in]RES
          RES is DOUBLE PRECISION array, dimension (N)
     Workspace to hold the intermediate residual.
[in]AYB
          AYB is DOUBLE PRECISION array, dimension (N)
     Workspace. This can be the same workspace passed for Y_TAIL.
[in]DY
          DY is DOUBLE PRECISION array, dimension (N)
     Workspace to hold the intermediate solution.
[in]Y_TAIL
          Y_TAIL is DOUBLE PRECISION array, dimension (N)
     Workspace to hold the trailing bits of the intermediate solution.
[in]RCOND
          RCOND is DOUBLE PRECISION
     Reciprocal scaled condition number.  This is an estimate of the
     reciprocal Skeel condition number of the matrix A after
     equilibration (if done).  If this is less than the machine
     precision (in particular, if it is zero), the matrix is singular
     to working precision.  Note that the error may still be small even
     if this number is very small and the matrix appears ill-
     conditioned.
[in]ITHRESH
          ITHRESH is INTEGER
     The maximum number of residual computations allowed for
     refinement. The default is 10. For 'aggressive' set to 100 to
     permit convergence using approximate factorizations or
     factorizations other than LU. If the factorization uses a
     technique other than Gaussian elimination, the guarantees in
     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
[in]RTHRESH
          RTHRESH is DOUBLE PRECISION
     Determines when to stop refinement if the error estimate stops
     decreasing. Refinement will stop when the next solution no longer
     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
     default value is 0.5. For 'aggressive' set to 0.9 to permit
     convergence on extremely ill-conditioned matrices. See LAWN 165
     for more details.
[in]DZ_UB
          DZ_UB is DOUBLE PRECISION
     Determines when to start considering componentwise convergence.
     Componentwise convergence is only considered after each component
     of the solution Y is stable, which we definte as the relative
     change in each component being less than DZ_UB. The default value
     is 0.25, requiring the first bit to be stable. See LAWN 165 for
     more details.
[in]IGNORE_CWISE
          IGNORE_CWISE is LOGICAL
     If .TRUE. then ignore componentwise convergence. Default value
     is .FALSE..
[out]INFO
          INFO is INTEGER
       = 0:  Successful exit.
       < 0:  if INFO = -i, the ith argument to DGBTRS had an illegal
             value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 416 of file dla_gbrfsx_extended.f.

416 *
417 * -- LAPACK computational routine (version 3.4.2) --
418 * -- LAPACK is a software package provided by Univ. of Tennessee, --
419 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
420 * September 2012
421 *
422 * .. Scalar Arguments ..
423  INTEGER info, ldab, ldafb, ldb, ldy, n, kl, ku, nrhs,
424  $ prec_type, trans_type, n_norms, ithresh
425  LOGICAL colequ, ignore_cwise
426  DOUBLE PRECISION rthresh, dz_ub
427 * ..
428 * .. Array Arguments ..
429  INTEGER ipiv( * )
430  DOUBLE PRECISION ab( ldab, * ), afb( ldafb, * ), b( ldb, * ),
431  $ y( ldy, * ), res(*), dy(*), y_tail(*)
432  DOUBLE PRECISION c( * ), ayb(*), rcond, berr_out(*),
433  $ err_bnds_norm( nrhs, * ),
434  $ err_bnds_comp( nrhs, * )
435 * ..
436 *
437 * =====================================================================
438 *
439 * .. Local Scalars ..
440  CHARACTER trans
441  INTEGER cnt, i, j, m, x_state, z_state, y_prec_state
442  DOUBLE PRECISION yk, dyk, ymin, normy, normx, normdx, dxrat,
443  $ dzrat, prevnormdx, prev_dz_z, dxratmax,
444  $ dzratmax, dx_x, dz_z, final_dx_x, final_dz_z,
445  $ eps, hugeval, incr_thresh
446  LOGICAL incr_prec
447 * ..
448 * .. Parameters ..
449  INTEGER unstable_state, working_state, conv_state,
450  $ noprog_state, base_residual, extra_residual,
451  $ extra_y
452  parameter( unstable_state = 0, working_state = 1,
453  $ conv_state = 2, noprog_state = 3 )
454  parameter( base_residual = 0, extra_residual = 1,
455  $ extra_y = 2 )
456  INTEGER final_nrm_err_i, final_cmp_err_i, berr_i
457  INTEGER rcond_i, nrm_rcond_i, nrm_err_i, cmp_rcond_i
458  INTEGER cmp_err_i, piv_growth_i
459  parameter( final_nrm_err_i = 1, final_cmp_err_i = 2,
460  $ berr_i = 3 )
461  parameter( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
462  parameter( cmp_rcond_i = 7, cmp_err_i = 8,
463  $ piv_growth_i = 9 )
464  INTEGER la_linrx_itref_i, la_linrx_ithresh_i,
465  $ la_linrx_cwise_i
466  parameter( la_linrx_itref_i = 1,
467  $ la_linrx_ithresh_i = 2 )
468  parameter( la_linrx_cwise_i = 3 )
469  INTEGER la_linrx_trust_i, la_linrx_err_i,
470  $ la_linrx_rcond_i
471  parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
472  parameter( la_linrx_rcond_i = 3 )
473 * ..
474 * .. External Subroutines ..
475  EXTERNAL daxpy, dcopy, dgbtrs, dgbmv, blas_dgbmv_x,
476  $ blas_dgbmv2_x, dla_gbamv, dla_wwaddw, dlamch,
478  DOUBLE PRECISION dlamch
479  CHARACTER chla_transtype
480 * ..
481 * .. Intrinsic Functions ..
482  INTRINSIC abs, max, min
483 * ..
484 * .. Executable Statements ..
485 *
486  IF (info.NE.0) RETURN
487  trans = chla_transtype(trans_type)
488  eps = dlamch( 'Epsilon' )
489  hugeval = dlamch( 'Overflow' )
490 * Force HUGEVAL to Inf
491  hugeval = hugeval * hugeval
492 * Using HUGEVAL may lead to spurious underflows.
493  incr_thresh = dble( n ) * eps
494  m = kl+ku+1
495 
496  DO j = 1, nrhs
497  y_prec_state = extra_residual
498  IF ( y_prec_state .EQ. extra_y ) THEN
499  DO i = 1, n
500  y_tail( i ) = 0.0d+0
501  END DO
502  END IF
503 
504  dxrat = 0.0d+0
505  dxratmax = 0.0d+0
506  dzrat = 0.0d+0
507  dzratmax = 0.0d+0
508  final_dx_x = hugeval
509  final_dz_z = hugeval
510  prevnormdx = hugeval
511  prev_dz_z = hugeval
512  dz_z = hugeval
513  dx_x = hugeval
514 
515  x_state = working_state
516  z_state = unstable_state
517  incr_prec = .false.
518 
519  DO cnt = 1, ithresh
520 *
521 * Compute residual RES = B_s - op(A_s) * Y,
522 * op(A) = A, A**T, or A**H depending on TRANS (and type).
523 *
524  CALL dcopy( n, b( 1, j ), 1, res, 1 )
525  IF ( y_prec_state .EQ. base_residual ) THEN
526  CALL dgbmv( trans, m, n, kl, ku, -1.0d+0, ab, ldab,
527  $ y( 1, j ), 1, 1.0d+0, res, 1 )
528  ELSE IF ( y_prec_state .EQ. extra_residual ) THEN
529  CALL blas_dgbmv_x( trans_type, n, n, kl, ku,
530  $ -1.0d+0, ab, ldab, y( 1, j ), 1, 1.0d+0, res, 1,
531  $ prec_type )
532  ELSE
533  CALL blas_dgbmv2_x( trans_type, n, n, kl, ku, -1.0d+0,
534  $ ab, ldab, y( 1, j ), y_tail, 1, 1.0d+0, res, 1,
535  $ prec_type )
536  END IF
537 
538 ! XXX: RES is no longer needed.
539  CALL dcopy( n, res, 1, dy, 1 )
540  CALL dgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv, dy, n,
541  $ info )
542 *
543 * Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
544 *
545  normx = 0.0d+0
546  normy = 0.0d+0
547  normdx = 0.0d+0
548  dz_z = 0.0d+0
549  ymin = hugeval
550 
551  DO i = 1, n
552  yk = abs( y( i, j ) )
553  dyk = abs( dy( i ) )
554 
555  IF ( yk .NE. 0.0d+0 ) THEN
556  dz_z = max( dz_z, dyk / yk )
557  ELSE IF ( dyk .NE. 0.0d+0 ) THEN
558  dz_z = hugeval
559  END IF
560 
561  ymin = min( ymin, yk )
562 
563  normy = max( normy, yk )
564 
565  IF ( colequ ) THEN
566  normx = max( normx, yk * c( i ) )
567  normdx = max( normdx, dyk * c( i ) )
568  ELSE
569  normx = normy
570  normdx = max( normdx, dyk )
571  END IF
572  END DO
573 
574  IF ( normx .NE. 0.0d+0 ) THEN
575  dx_x = normdx / normx
576  ELSE IF ( normdx .EQ. 0.0d+0 ) THEN
577  dx_x = 0.0d+0
578  ELSE
579  dx_x = hugeval
580  END IF
581 
582  dxrat = normdx / prevnormdx
583  dzrat = dz_z / prev_dz_z
584 *
585 * Check termination criteria.
586 *
587  IF ( .NOT.ignore_cwise
588  $ .AND. ymin*rcond .LT. incr_thresh*normy
589  $ .AND. y_prec_state .LT. extra_y )
590  $ incr_prec = .true.
591 
592  IF ( x_state .EQ. noprog_state .AND. dxrat .LE. rthresh )
593  $ x_state = working_state
594  IF ( x_state .EQ. working_state ) THEN
595  IF ( dx_x .LE. eps ) THEN
596  x_state = conv_state
597  ELSE IF ( dxrat .GT. rthresh ) THEN
598  IF ( y_prec_state .NE. extra_y ) THEN
599  incr_prec = .true.
600  ELSE
601  x_state = noprog_state
602  END IF
603  ELSE
604  IF ( dxrat .GT. dxratmax ) dxratmax = dxrat
605  END IF
606  IF ( x_state .GT. working_state ) final_dx_x = dx_x
607  END IF
608 
609  IF ( z_state .EQ. unstable_state .AND. dz_z .LE. dz_ub )
610  $ z_state = working_state
611  IF ( z_state .EQ. noprog_state .AND. dzrat .LE. rthresh )
612  $ z_state = working_state
613  IF ( z_state .EQ. working_state ) THEN
614  IF ( dz_z .LE. eps ) THEN
615  z_state = conv_state
616  ELSE IF ( dz_z .GT. dz_ub ) THEN
617  z_state = unstable_state
618  dzratmax = 0.0d+0
619  final_dz_z = hugeval
620  ELSE IF ( dzrat .GT. rthresh ) THEN
621  IF ( y_prec_state .NE. extra_y ) THEN
622  incr_prec = .true.
623  ELSE
624  z_state = noprog_state
625  END IF
626  ELSE
627  IF ( dzrat .GT. dzratmax ) dzratmax = dzrat
628  END IF
629  IF ( z_state .GT. working_state ) final_dz_z = dz_z
630  END IF
631 *
632 * Exit if both normwise and componentwise stopped working,
633 * but if componentwise is unstable, let it go at least two
634 * iterations.
635 *
636  IF ( x_state.NE.working_state ) THEN
637  IF ( ignore_cwise ) GOTO 666
638  IF ( z_state.EQ.noprog_state .OR. z_state.EQ.conv_state )
639  $ GOTO 666
640  IF ( z_state.EQ.unstable_state .AND. cnt.GT.1 ) GOTO 666
641  END IF
642 
643  IF ( incr_prec ) THEN
644  incr_prec = .false.
645  y_prec_state = y_prec_state + 1
646  DO i = 1, n
647  y_tail( i ) = 0.0d+0
648  END DO
649  END IF
650 
651  prevnormdx = normdx
652  prev_dz_z = dz_z
653 *
654 * Update soluton.
655 *
656  IF (y_prec_state .LT. extra_y) THEN
657  CALL daxpy( n, 1.0d+0, dy, 1, y(1,j), 1 )
658  ELSE
659  CALL dla_wwaddw( n, y(1,j), y_tail, dy )
660  END IF
661 
662  END DO
663 * Target of "IF (Z_STOP .AND. X_STOP)". Sun's f77 won't EXIT.
664  666 CONTINUE
665 *
666 * Set final_* when cnt hits ithresh.
667 *
668  IF ( x_state .EQ. working_state ) final_dx_x = dx_x
669  IF ( z_state .EQ. working_state ) final_dz_z = dz_z
670 *
671 * Compute error bounds.
672 *
673  IF ( n_norms .GE. 1 ) THEN
674  err_bnds_norm( j, la_linrx_err_i ) =
675  $ final_dx_x / (1 - dxratmax)
676  END IF
677  IF (n_norms .GE. 2) THEN
678  err_bnds_comp( j, la_linrx_err_i ) =
679  $ final_dz_z / (1 - dzratmax)
680  END IF
681 *
682 * Compute componentwise relative backward error from formula
683 * max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
684 * where abs(Z) is the componentwise absolute value of the matrix
685 * or vector Z.
686 *
687 * Compute residual RES = B_s - op(A_s) * Y,
688 * op(A) = A, A**T, or A**H depending on TRANS (and type).
689 *
690  CALL dcopy( n, b( 1, j ), 1, res, 1 )
691  CALL dgbmv(trans, n, n, kl, ku, -1.0d+0, ab, ldab, y(1,j),
692  $ 1, 1.0d+0, res, 1 )
693 
694  DO i = 1, n
695  ayb( i ) = abs( b( i, j ) )
696  END DO
697 *
698 * Compute abs(op(A_s))*abs(Y) + abs(B_s).
699 *
700  CALL dla_gbamv( trans_type, n, n, kl, ku, 1.0d+0,
701  $ ab, ldab, y(1, j), 1, 1.0d+0, ayb, 1 )
702 
703  CALL dla_lin_berr( n, n, 1, res, ayb, berr_out( j ) )
704 *
705 * End of loop for each RHS
706 *
707  END DO
708 *
709  RETURN
subroutine dla_lin_berr(N, NZ, NRHS, RES, AYB, BERR)
DLA_LIN_BERR computes a component-wise relative backward error.
Definition: dla_lin_berr.f:103
subroutine dla_wwaddw(N, X, Y, W)
DLA_WWADDW adds a vector into a doubled-single vector.
Definition: dla_wwaddw.f:83
subroutine dla_gbamv(TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X, INCX, BETA, Y, INCY)
DLA_GBAMV performs a matrix-vector operation to calculate error bounds.
Definition: dla_gbamv.f:187
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dgbmv(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
DGBMV
Definition: dgbmv.f:187
character *1 function chla_transtype(TRANS)
CHLA_TRANSTYPE
subroutine dcopy(N, DX, INCX, DY, INCY)
DCOPY
Definition: dcopy.f:53
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:54
subroutine dgbtrs(TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
DGBTRS
Definition: dgbtrs.f:140

Here is the call graph for this function:

Here is the caller graph for this function:

double precision function dla_gbrpvgrw ( integer  N,
integer  KL,
integer  KU,
integer  NCOLS,
double precision, dimension( ldab, * )  AB,
integer  LDAB,
double precision, dimension( ldafb, * )  AFB,
integer  LDAFB 
)

DLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix.

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

Purpose:
 DLA_GBRPVGRW computes the reciprocal pivot growth factor
 norm(A)/norm(U). The "max absolute element" norm is used. If this is
 much less than 1, the stability of the LU factorization of the
 (equilibrated) matrix A could be poor. This also means that the
 solution X, estimated condition numbers, and error bounds could be
 unreliable.
Parameters
[in]N
          N is INTEGER
     The number of linear equations, i.e., the order of the
     matrix A.  N >= 0.
[in]KL
          KL is INTEGER
     The number of subdiagonals within the band of A.  KL >= 0.
[in]KU
          KU is INTEGER
     The number of superdiagonals within the band of A.  KU >= 0.
[in]NCOLS
          NCOLS is INTEGER
     The number of columns of the matrix A.  NCOLS >= 0.
[in]AB
          AB is DOUBLE PRECISION array, dimension (LDAB,N)
     On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
     The j-th column of A is stored in the j-th column of the
     array AB as follows:
     AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
[in]LDAB
          LDAB is INTEGER
     The leading dimension of the array AB.  LDAB >= KL+KU+1.
[in]AFB
          AFB is DOUBLE PRECISION array, dimension (LDAFB,N)
     Details of the LU factorization of the band matrix A, as
     computed by DGBTRF.  U is stored as an upper triangular
     band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
     and the multipliers used during the factorization are stored
     in rows KL+KU+2 to 2*KL+KU+1.
[in]LDAFB
          LDAFB is INTEGER
     The leading dimension of the array AFB.  LDAFB >= 2*KL+KU+1.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 119 of file dla_gbrpvgrw.f.

119 *
120 * -- LAPACK computational routine (version 3.4.2) --
121 * -- LAPACK is a software package provided by Univ. of Tennessee, --
122 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
123 * September 2012
124 *
125 * .. Scalar Arguments ..
126  INTEGER n, kl, ku, ncols, ldab, ldafb
127 * ..
128 * .. Array Arguments ..
129  DOUBLE PRECISION ab( ldab, * ), afb( ldafb, * )
130 * ..
131 *
132 * =====================================================================
133 *
134 * .. Local Scalars ..
135  INTEGER i, j, kd
136  DOUBLE PRECISION amax, umax, rpvgrw
137 * ..
138 * .. Intrinsic Functions ..
139  INTRINSIC abs, max, min
140 * ..
141 * .. Executable Statements ..
142 *
143  rpvgrw = 1.0d+0
144 
145  kd = ku + 1
146  DO j = 1, ncols
147  amax = 0.0d+0
148  umax = 0.0d+0
149  DO i = max( j-ku, 1 ), min( j+kl, n )
150  amax = max( abs( ab( kd+i-j, j)), amax )
151  END DO
152  DO i = max( j-ku, 1 ), j
153  umax = max( abs( afb( kd+i-j, j ) ), umax )
154  END DO
155  IF ( umax /= 0.0d+0 ) THEN
156  rpvgrw = min( amax / umax, rpvgrw )
157  END IF
158  END DO
159  dla_gbrpvgrw = rpvgrw
double precision function dla_gbrpvgrw(N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB)
DLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix...
Definition: dla_gbrpvgrw.f:119

Here is the caller graph for this function:

subroutine dorgbr ( character  VECT,
integer  M,
integer  N,
integer  K,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  TAU,
double precision, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

DORGBR

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

Purpose:
 DORGBR generates one of the real orthogonal matrices Q or P**T
 determined by DGEBRD when reducing a real matrix A to bidiagonal
 form: A = Q * B * P**T.  Q and P**T are defined as products of
 elementary reflectors H(i) or G(i) respectively.

 If VECT = 'Q', A is assumed to have been an M-by-K matrix, and Q
 is of order M:
 if m >= k, Q = H(1) H(2) . . . H(k) and DORGBR returns the first n
 columns of Q, where m >= n >= k;
 if m < k, Q = H(1) H(2) . . . H(m-1) and DORGBR returns Q as an
 M-by-M matrix.

 If VECT = 'P', A is assumed to have been a K-by-N matrix, and P**T
 is of order N:
 if k < n, P**T = G(k) . . . G(2) G(1) and DORGBR returns the first m
 rows of P**T, where n >= m >= k;
 if k >= n, P**T = G(n-1) . . . G(2) G(1) and DORGBR returns P**T as
 an N-by-N matrix.
Parameters
[in]VECT
          VECT is CHARACTER*1
          Specifies whether the matrix Q or the matrix P**T is
          required, as defined in the transformation applied by DGEBRD:
          = 'Q':  generate Q;
          = 'P':  generate P**T.
[in]M
          M is INTEGER
          The number of rows of the matrix Q or P**T to be returned.
          M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix Q or P**T to be returned.
          N >= 0.
          If VECT = 'Q', M >= N >= min(M,K);
          if VECT = 'P', N >= M >= min(N,K).
[in]K
          K is INTEGER
          If VECT = 'Q', the number of columns in the original M-by-K
          matrix reduced by DGEBRD.
          If VECT = 'P', the number of rows in the original K-by-N
          matrix reduced by DGEBRD.
          K >= 0.
[in,out]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the vectors which define the elementary reflectors,
          as returned by DGEBRD.
          On exit, the M-by-N matrix Q or P**T.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A. LDA >= max(1,M).
[in]TAU
          TAU is DOUBLE PRECISION array, dimension
                                (min(M,K)) if VECT = 'Q'
                                (min(N,K)) if VECT = 'P'
          TAU(i) must contain the scalar factor of the elementary
          reflector H(i) or G(i), which determines Q or P**T, as
          returned by DGEBRD in its array argument TAUQ or TAUP.
[out]WORK
          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK. LWORK >= max(1,min(M,N)).
          For optimum performance LWORK >= min(M,N)*NB, where NB
          is the optimal blocksize.

          If LWORK = -1, then a workspace query is assumed; the routine
          only calculates the optimal size of the WORK array, returns
          this value as the first entry of the WORK array, and no error
          message related to LWORK is issued by XERBLA.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
April 2012

Definition at line 159 of file dorgbr.f.

159 *
160 * -- LAPACK computational routine (version 3.4.1) --
161 * -- LAPACK is a software package provided by Univ. of Tennessee, --
162 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
163 * April 2012
164 *
165 * .. Scalar Arguments ..
166  CHARACTER vect
167  INTEGER info, k, lda, lwork, m, n
168 * ..
169 * .. Array Arguments ..
170  DOUBLE PRECISION a( lda, * ), tau( * ), work( * )
171 * ..
172 *
173 * =====================================================================
174 *
175 * .. Parameters ..
176  DOUBLE PRECISION zero, one
177  parameter( zero = 0.0d+0, one = 1.0d+0 )
178 * ..
179 * .. Local Scalars ..
180  LOGICAL lquery, wantq
181  INTEGER i, iinfo, j, lwkopt, mn
182 * ..
183 * .. External Functions ..
184  LOGICAL lsame
185  INTEGER ilaenv
186  EXTERNAL lsame, ilaenv
187 * ..
188 * .. External Subroutines ..
189  EXTERNAL dorglq, dorgqr, xerbla
190 * ..
191 * .. Intrinsic Functions ..
192  INTRINSIC max, min
193 * ..
194 * .. Executable Statements ..
195 *
196 * Test the input arguments
197 *
198  info = 0
199  wantq = lsame( vect, 'Q' )
200  mn = min( m, n )
201  lquery = ( lwork.EQ.-1 )
202  IF( .NOT.wantq .AND. .NOT.lsame( vect, 'P' ) ) THEN
203  info = -1
204  ELSE IF( m.LT.0 ) THEN
205  info = -2
206  ELSE IF( n.LT.0 .OR. ( wantq .AND. ( n.GT.m .OR. n.LT.min( m,
207  $ k ) ) ) .OR. ( .NOT.wantq .AND. ( m.GT.n .OR. m.LT.
208  $ min( n, k ) ) ) ) THEN
209  info = -3
210  ELSE IF( k.LT.0 ) THEN
211  info = -4
212  ELSE IF( lda.LT.max( 1, m ) ) THEN
213  info = -6
214  ELSE IF( lwork.LT.max( 1, mn ) .AND. .NOT.lquery ) THEN
215  info = -9
216  END IF
217 *
218  IF( info.EQ.0 ) THEN
219  work( 1 ) = 1
220  IF( wantq ) THEN
221  IF( m.GE.k ) THEN
222  CALL dorgqr( m, n, k, a, lda, tau, work, -1, iinfo )
223  ELSE
224  IF( m.GT.1 ) THEN
225  CALL dorgqr( m-1, m-1, m-1, a( 2, 2 ), lda, tau, work,
226  $ -1, iinfo )
227  END IF
228  END IF
229  ELSE
230  IF( k.LT.n ) THEN
231  CALL dorglq( m, n, k, a, lda, tau, work, -1, iinfo )
232  ELSE
233  IF( n.GT.1 ) THEN
234  CALL dorglq( n-1, n-1, n-1, a( 2, 2 ), lda, tau, work,
235  $ -1, iinfo )
236  END IF
237  END IF
238  END IF
239  lwkopt = work( 1 )
240  lwkopt = max(lwkopt, mn)
241  END IF
242 *
243  IF( info.NE.0 ) THEN
244  CALL xerbla( 'DORGBR', -info )
245  RETURN
246  ELSE IF( lquery ) THEN
247  work( 1 ) = lwkopt
248  RETURN
249  END IF
250 *
251 * Quick return if possible
252 *
253  IF( m.EQ.0 .OR. n.EQ.0 ) THEN
254  work( 1 ) = 1
255  RETURN
256  END IF
257 *
258  IF( wantq ) THEN
259 *
260 * Form Q, determined by a call to DGEBRD to reduce an m-by-k
261 * matrix
262 *
263  IF( m.GE.k ) THEN
264 *
265 * If m >= k, assume m >= n >= k
266 *
267  CALL dorgqr( m, n, k, a, lda, tau, work, lwork, iinfo )
268 *
269  ELSE
270 *
271 * If m < k, assume m = n
272 *
273 * Shift the vectors which define the elementary reflectors one
274 * column to the right, and set the first row and column of Q
275 * to those of the unit matrix
276 *
277  DO 20 j = m, 2, -1
278  a( 1, j ) = zero
279  DO 10 i = j + 1, m
280  a( i, j ) = a( i, j-1 )
281  10 CONTINUE
282  20 CONTINUE
283  a( 1, 1 ) = one
284  DO 30 i = 2, m
285  a( i, 1 ) = zero
286  30 CONTINUE
287  IF( m.GT.1 ) THEN
288 *
289 * Form Q(2:m,2:m)
290 *
291  CALL dorgqr( m-1, m-1, m-1, a( 2, 2 ), lda, tau, work,
292  $ lwork, iinfo )
293  END IF
294  END IF
295  ELSE
296 *
297 * Form P**T, determined by a call to DGEBRD to reduce a k-by-n
298 * matrix
299 *
300  IF( k.LT.n ) THEN
301 *
302 * If k < n, assume k <= m <= n
303 *
304  CALL dorglq( m, n, k, a, lda, tau, work, lwork, iinfo )
305 *
306  ELSE
307 *
308 * If k >= n, assume m = n
309 *
310 * Shift the vectors which define the elementary reflectors one
311 * row downward, and set the first row and column of P**T to
312 * those of the unit matrix
313 *
314  a( 1, 1 ) = one
315  DO 40 i = 2, n
316  a( i, 1 ) = zero
317  40 CONTINUE
318  DO 60 j = 2, n
319  DO 50 i = j - 1, 2, -1
320  a( i, j ) = a( i-1, j )
321  50 CONTINUE
322  a( 1, j ) = zero
323  60 CONTINUE
324  IF( n.GT.1 ) THEN
325 *
326 * Form P**T(2:n,2:n)
327 *
328  CALL dorglq( n-1, n-1, n-1, a( 2, 2 ), lda, tau, work,
329  $ lwork, iinfo )
330  END IF
331  END IF
332  END IF
333  work( 1 ) = lwkopt
334  RETURN
335 *
336 * End of DORGBR
337 *
subroutine dorglq(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
DORGLQ
Definition: dorglq.f:129
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dorgqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
DORGQR
Definition: dorgqr.f:130
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83

Here is the call graph for this function:

Here is the caller graph for this function: