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

Functions

subroutine sgbbrd (VECT, M, N, NCC, KL, KU, AB, LDAB, D, E, Q, LDQ, PT, LDPT, C, LDC, WORK, INFO)
 SGBBRD More...
 
subroutine sgbcon (NORM, N, KL, KU, AB, LDAB, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
 SGBCON More...
 
subroutine sgbequ (M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX, INFO)
 SGBEQU More...
 
subroutine sgbequb (M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX, INFO)
 SGBEQUB More...
 
subroutine sgbrfs (TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO)
 SGBRFS More...
 
subroutine sgbrfsx (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)
 SGBRFSX More...
 
subroutine sgbtf2 (M, N, KL, KU, AB, LDAB, IPIV, INFO)
 SGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algorithm. More...
 
subroutine sgbtrf (M, N, KL, KU, AB, LDAB, IPIV, INFO)
 SGBTRF More...
 
subroutine sgbtrs (TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
 SGBTRS More...
 
subroutine sggbak (JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V, LDV, INFO)
 SGGBAK More...
 
subroutine sggbal (JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
 SGGBAL More...
 
subroutine sla_gbamv (TRANS, M, N, KL, KU, ALPHA, AB, LDAB, X, INCX, BETA, Y, INCY)
 SLA_GBAMV performs a matrix-vector operation to calculate error bounds. More...
 
real function sla_gbrcond (TRANS, N, KL, KU, AB, LDAB, AFB, LDAFB, IPIV, CMODE, C, INFO, WORK, IWORK)
 SLA_GBRCOND estimates the Skeel condition number for a general banded matrix. More...
 
subroutine sla_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)
 SLA_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...
 
real function sla_gbrpvgrw (N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB)
 SLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix. More...
 
subroutine sorgbr (VECT, M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
 SORGBR More...
 

Detailed Description

This is the group of real computational functions for GB matrices

Function Documentation

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

SGBBRD

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

Purpose:
 SGBBRD 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 REAL 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 REAL array, dimension (min(M,N))
          The diagonal elements of the bidiagonal matrix B.
[out]E
          E is REAL array, dimension (min(M,N)-1)
          The superdiagonal elements of the bidiagonal matrix B.
[out]Q
          Q is REAL 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 REAL 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 REAL 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 REAL 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 sgbbrd.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  REAL ab( ldab, * ), c( ldc, * ), d( * ), e( * ),
201  $ pt( ldpt, * ), q( ldq, * ), work( * )
202 * ..
203 *
204 * =====================================================================
205 *
206 * .. Parameters ..
207  REAL zero, one
208  parameter( zero = 0.0e+0, one = 1.0e+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  REAL ra, rb, rc, rs
215 * ..
216 * .. External Subroutines ..
217  EXTERNAL slargv, slartg, slartv, slaset, srot, 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( 'SGBBRD', -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 slaset( 'Full', m, m, zero, one, q, ldq )
267  IF( wantpt )
268  $ CALL slaset( '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 slargv( 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 slartv( 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 slartg( 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 srot( 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 srot( 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 srot( 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 slargv( 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 slartv( 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 slartg( 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 srot( 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 srot( 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 slartg( 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 srot( m, q( 1, i ), 1, q( 1, i+1 ), 1, rc, rs )
492  IF( wantc )
493  $ CALL srot( 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 slartg( 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 srot( 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 SGBBRD
546 *
subroutine slartg(F, G, CS, SN, R)
SLARTG generates a plane rotation with real cosine and real sine.
Definition: slartg.f:99
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine slargv(N, X, INCX, Y, INCY, C, INCC)
SLARGV generates a vector of plane rotations with real cosines and real sines.
Definition: slargv.f:106
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slartv(N, X, INCX, Y, INCY, C, S, INCC)
SLARTV applies a vector of plane rotations with real cosines and real sines to the elements of a pair...
Definition: slartv.f:110
subroutine srot(N, SX, INCX, SY, INCY, C, S)
SROT
Definition: srot.f:53
subroutine slaset(UPLO, M, N, ALPHA, BETA, A, LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: slaset.f:112

Here is the call graph for this function:

Here is the caller graph for this function:

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

SGBCON

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

Purpose:
 SGBCON 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 SGBTRF.

 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 REAL array, dimension (LDAB,N)
          Details of the LU factorization of the band matrix A, as
          computed by SGBTRF.  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 REAL
          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 REAL
          The reciprocal of the condition number of the matrix A,
          computed as RCOND = 1/(norm(A) * norm(inv(A))).
[out]WORK
          WORK is REAL 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 sgbcon.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  REAL anorm, rcond
158 * ..
159 * .. Array Arguments ..
160  INTEGER ipiv( * ), iwork( * )
161  REAL ab( ldab, * ), work( * )
162 * ..
163 *
164 * =====================================================================
165 *
166 * .. Parameters ..
167  REAL one, zero
168  parameter( one = 1.0e+0, zero = 0.0e+0 )
169 * ..
170 * .. Local Scalars ..
171  LOGICAL lnoti, onenrm
172  CHARACTER normin
173  INTEGER ix, j, jp, kase, kase1, kd, lm
174  REAL ainvnm, scale, smlnum, t
175 * ..
176 * .. Local Arrays ..
177  INTEGER isave( 3 )
178 * ..
179 * .. External Functions ..
180  LOGICAL lsame
181  INTEGER isamax
182  REAL sdot, slamch
183  EXTERNAL lsame, isamax, sdot, slamch
184 * ..
185 * .. External Subroutines ..
186  EXTERNAL saxpy, slacn2, slatbs, srscl, 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( 'SGBCON', -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 = slamch( '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 slacn2( 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 saxpy( 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 slatbs( '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 slatbs( '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 ) - sdot( 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 = isamax( n, work, 1 )
294  IF( scale.LT.abs( work( ix ) )*smlnum .OR. scale.EQ.zero )
295  $ GO TO 40
296  CALL srscl( 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 SGBCON
310 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine srscl(N, SA, SX, INCX)
SRSCL multiplies a vector by the reciprocal of a real scalar.
Definition: srscl.f:86
subroutine slacn2(N, V, X, ISGN, EST, KASE, ISAVE)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: slacn2.f:138
real function sdot(N, SX, INCX, SY, INCY)
SDOT
Definition: sdot.f:53
subroutine slatbs(UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X, SCALE, CNORM, INFO)
SLATBS solves a triangular banded system of equations.
Definition: slatbs.f:244

Here is the call graph for this function:

Here is the caller graph for this function:

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

SGBEQU

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

Purpose:
 SGBEQU 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 REAL 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 REAL array, dimension (M)
          If INFO = 0, or INFO > M, R contains the row scale factors
          for A.
[out]C
          C is REAL array, dimension (N)
          If INFO = 0, C contains the column scale factors for A.
[out]ROWCND
          ROWCND is REAL
          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 REAL
          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 REAL
          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 sgbequ.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  REAL amax, colcnd, rowcnd
164 * ..
165 * .. Array Arguments ..
166  REAL ab( ldab, * ), c( * ), r( * )
167 * ..
168 *
169 * =====================================================================
170 *
171 * .. Parameters ..
172  REAL one, zero
173  parameter( one = 1.0e+0, zero = 0.0e+0 )
174 * ..
175 * .. Local Scalars ..
176  INTEGER i, j, kd
177  REAL bignum, rcmax, rcmin, smlnum
178 * ..
179 * .. External Functions ..
180  REAL slamch
181  EXTERNAL slamch
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( 'SGBEQU', -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 = slamch( '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 SGBEQU
323 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62

Here is the call graph for this function:

Here is the caller graph for this function:

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

SGBEQUB

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

Purpose:
 SGBEQUB 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 SGEEQU 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 REAL array, dimension (M)
          If INFO = 0 or INFO > M, R contains the row scale factors
          for A.
[out]C
          C is REAL array, dimension (N)
          If INFO = 0,  C contains the column scale factors for A.
[out]ROWCND
          ROWCND is REAL
          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 REAL
          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 REAL
          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 sgbequb.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  REAL amax, colcnd, rowcnd
171 * ..
172 * .. Array Arguments ..
173  REAL ab( ldab, * ), c( * ), r( * )
174 * ..
175 *
176 * =====================================================================
177 *
178 * .. Parameters ..
179  REAL one, zero
180  parameter( one = 1.0e+0, zero = 0.0e+0 )
181 * ..
182 * .. Local Scalars ..
183  INTEGER i, j, kd
184  REAL bignum, rcmax, rcmin, smlnum, radix, logrdx
185 * ..
186 * .. External Functions ..
187  REAL slamch
188  EXTERNAL slamch
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( 'SGBEQUB', -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 = slamch( 'S' )
229  bignum = one / smlnum
230  radix = slamch( '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 SGBEQUB
339 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine sgbrfs ( character  TRANS,
integer  N,
integer  KL,
integer  KU,
integer  NRHS,
real, dimension( ldab, * )  AB,
integer  LDAB,
real, dimension( ldafb, * )  AFB,
integer  LDAFB,
integer, dimension( * )  IPIV,
real, dimension( ldb, * )  B,
integer  LDB,
real, dimension( ldx, * )  X,
integer  LDX,
real, dimension( * )  FERR,
real, dimension( * )  BERR,
real, dimension( * )  WORK,
integer, dimension( * )  IWORK,
integer  INFO 
)

SGBRFS

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

Purpose:
 SGBRFS 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 REAL 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 REAL array, dimension (LDAFB,N)
          Details of the LU factorization of the band matrix A, as
          computed by SGBTRF.  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 SGBTRF; for 1<=i<=N, row i of the
          matrix was interchanged with row IPIV(i).
[in]B
          B is REAL 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 REAL array, dimension (LDX,NRHS)
          On entry, the solution matrix X, as computed by SGBTRS.
          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 REAL 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 REAL 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 REAL 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 sgbrfs.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  REAL 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  REAL zero
229  parameter( zero = 0.0e+0 )
230  REAL one
231  parameter( one = 1.0e+0 )
232  REAL two
233  parameter( two = 2.0e+0 )
234  REAL three
235  parameter( three = 3.0e+0 )
236 * ..
237 * .. Local Scalars ..
238  LOGICAL notran
239  CHARACTER transt
240  INTEGER count, i, j, k, kase, kk, nz
241  REAL eps, lstres, s, safe1, safe2, safmin, xk
242 * ..
243 * .. Local Arrays ..
244  INTEGER isave( 3 )
245 * ..
246 * .. External Subroutines ..
247  EXTERNAL saxpy, scopy, sgbmv, sgbtrs, slacn2, xerbla
248 * ..
249 * .. Intrinsic Functions ..
250  INTRINSIC abs, max, min
251 * ..
252 * .. External Functions ..
253  LOGICAL lsame
254  REAL slamch
255  EXTERNAL lsame, slamch
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( 'SGBRFS', -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 = slamch( 'Epsilon' )
308  safmin = slamch( '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 scopy( n, b( 1, j ), 1, work( n+1 ), 1 )
326  CALL sgbmv( 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 sgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv,
385  $ work( n+1 ), n, info )
386  CALL saxpy( 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 SLACN2 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 slacn2( 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 sgbtrs( 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 sgbtrs( 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 SGBRFS
463 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine sgbtrs(TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
SGBTRS
Definition: sgbtrs.f:140
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine slacn2(N, V, X, ISGN, EST, KASE, ISAVE)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: slacn2.f:138
subroutine sgbmv(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGBMV
Definition: sgbmv.f:187

Here is the call graph for this function:

Here is the caller graph for this function:

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

SGBRFSX

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

Purpose:
    SGBRFSX 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 SGETRF; for 1<=i<=N, row i of the
     matrix was interchanged with row IPIV(i).
[in,out]R
          R is REAL 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 REAL 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 REAL 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 REAL array, dimension (LDX,NRHS)
     On entry, the solution matrix X, as computed by SGETRS.
     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 REAL
     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 REAL 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 REAL 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.

     See Lapack Working Note 165 for further details and extra
     cautions.
[out]ERR_BNDS_COMP
          ERR_BNDS_COMP is REAL 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.

     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 REAL 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.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 REAL 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 sgbrfsx.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  REAL rcond
453 * ..
454 * .. Array Arguments ..
455  INTEGER ipiv( * ), iwork( * )
456  REAL ab( ldab, * ), afb( ldafb, * ), b( ldb, * ),
457  $ x( ldx , * ),work( * )
458  REAL r( * ), c( * ), params( * ), berr( * ),
459  $ err_bnds_norm( nrhs, * ),
460  $ err_bnds_comp( nrhs, * )
461 * ..
462 *
463 * ==================================================================
464 *
465 * .. Parameters ..
466  REAL zero, one
467  parameter( zero = 0.0e+0, one = 1.0e+0 )
468  REAL itref_default, ithresh_default,
469  $ componentwise_default
470  REAL rthresh_default, dzthresh_default
471  parameter( itref_default = 1.0 )
472  parameter( ithresh_default = 10.0 )
473  parameter( componentwise_default = 1.0 )
474  parameter( rthresh_default = 0.5 )
475  parameter( dzthresh_default = 0.25 )
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  REAL anorm, rcond_tmp
492  REAL illrcond_thresh, err_lbnd, cwise_wrong
493  LOGICAL ignore_cwise
494  INTEGER ithresh
495  REAL rthresh, unstable_thresh
496 * ..
497 * .. External Subroutines ..
498  EXTERNAL xerbla, sgbcon
499  EXTERNAL sla_gbrfsx_extended
500 * ..
501 * .. Intrinsic Functions ..
502  INTRINSIC max, sqrt
503 * ..
504 * .. External Functions ..
505  EXTERNAL lsame, blas_fpinfo_x, ilatrans, ilaprec
506  EXTERNAL slamch, slangb, sla_gbrcond
507  REAL slamch, slangb, sla_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.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 = REAL( N ) * slamch( 'Epsilon' )
530  ithresh = int( ithresh_default )
531  rthresh = rthresh_default
532  unstable_thresh = dzthresh_default
533  ignore_cwise = componentwise_default .EQ. 0.0
534 *
535  IF ( nparams.GE.la_linrx_ithresh_i ) THEN
536  IF ( params( la_linrx_ithresh_i ).LT.0.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.0 ) THEN
544  IF ( ignore_cwise ) THEN
545  params( la_linrx_cwise_i ) = 0.0
546  ELSE
547  params( la_linrx_cwise_i ) = 1.0
548  END IF
549  ELSE
550  ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.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( 'SGBRFSX', -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.0
598  DO j = 1, nrhs
599  berr( j ) = 0.0
600  IF ( n_err_bnds .GE. 1 ) THEN
601  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
602  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
603  END IF
604  IF ( n_err_bnds .GE. 2 ) THEN
605  err_bnds_norm( j, la_linrx_err_i ) = 0.0
606  err_bnds_comp( j, la_linrx_err_i ) = 0.0
607  END IF
608  IF ( n_err_bnds .GE. 3 ) THEN
609  err_bnds_norm( j, la_linrx_rcond_i ) = 1.0
610  err_bnds_comp( j, la_linrx_rcond_i ) = 1.0
611  END IF
612  END DO
613  RETURN
614  END IF
615 *
616 * Default to failure.
617 *
618  rcond = 0.0
619  DO j = 1, nrhs
620  berr( j ) = 1.0
621  IF ( n_err_bnds .GE. 1 ) THEN
622  err_bnds_norm( j, la_linrx_trust_i ) = 1.0
623  err_bnds_comp( j, la_linrx_trust_i ) = 1.0
624  END IF
625  IF ( n_err_bnds .GE. 2 ) THEN
626  err_bnds_norm( j, la_linrx_err_i ) = 1.0
627  err_bnds_comp( j, la_linrx_err_i ) = 1.0
628  END IF
629  IF ( n_err_bnds .GE. 3 ) THEN
630  err_bnds_norm( j, la_linrx_rcond_i ) = 0.0
631  err_bnds_comp( j, la_linrx_rcond_i ) = 0.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 = slangb( norm, n, kl, ku, ab, ldab, work )
644  CALL sgbcon( 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( 'D' )
652 
653  IF ( notran ) THEN
654  CALL sla_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 sla_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.0, sqrt( REAL( N ) ) ) * slamch( '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 = sla_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 = sla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
680  $ ldafb, ipiv, -1, r, info, work, iwork )
681  ELSE
682  rcond_tmp = sla_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.0 )
691  $ err_bnds_norm( j, la_linrx_err_i ) = 1.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.0
697  err_bnds_norm( j, la_linrx_trust_i ) = 0.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.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( slamch( 'Epsilon' ) )
725  DO j = 1, nrhs
726  IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
727  $ THEN
728  rcond_tmp = sla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
729  $ ldafb, ipiv, 1, x( 1, j ), info, work, iwork )
730  ELSE
731  rcond_tmp = 0.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.0 )
738  $ err_bnds_comp( j, la_linrx_err_i ) = 1.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.0
744  err_bnds_comp( j, la_linrx_trust_i ) = 0.0
745  IF ( params( la_linrx_cwise_i ) .EQ. 1.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.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 SGBRFSX
765 *
integer function ilatrans(TRANS)
ILATRANS
Definition: ilatrans.f:60
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine sla_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)
SLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded...
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
integer function ilaprec(PREC)
ILAPREC
Definition: ilaprec.f:60
subroutine sgbcon(NORM, N, KL, KU, AB, LDAB, IPIV, ANORM, RCOND, WORK, IWORK, INFO)
SGBCON
Definition: sgbcon.f:148
real function sla_gbrcond(TRANS, N, KL, KU, AB, LDAB, AFB, LDAFB, IPIV, CMODE, C, INFO, WORK, IWORK)
SLA_GBRCOND estimates the Skeel condition number for a general banded matrix.
Definition: sla_gbrcond.f:170
real function slangb(NORM, N, KL, KU, AB, LDAB, WORK)
SLANGB returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slangb.f:126

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine sgbtf2 ( integer  M,
integer  N,
integer  KL,
integer  KU,
real, dimension( ldab, * )  AB,
integer  LDAB,
integer, dimension( * )  IPIV,
integer  INFO 
)

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

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

Purpose:
 SGBTF2 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 REAL 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 sgbtf2.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  REAL ab( ldab, * )
159 * ..
160 *
161 * =====================================================================
162 *
163 * .. Parameters ..
164  REAL one, zero
165  parameter( one = 1.0e+0, zero = 0.0e+0 )
166 * ..
167 * .. Local Scalars ..
168  INTEGER i, j, jp, ju, km, kv
169 * ..
170 * .. External Functions ..
171  INTEGER isamax
172  EXTERNAL isamax
173 * ..
174 * .. External Subroutines ..
175  EXTERNAL sger, sscal, sswap, 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( 'SGBTF2', -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 = isamax( 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 sswap( 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 sscal( 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 sger( 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 SGBTF2
276 *
subroutine sger(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
SGER
Definition: sger.f:132
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine sgbtrf ( integer  M,
integer  N,
integer  KL,
integer  KU,
real, dimension( ldab, * )  AB,
integer  LDAB,
integer, dimension( * )  IPIV,
integer  INFO 
)

SGBTRF

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

Purpose:
 SGBTRF 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 REAL 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 sgbtrf.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  REAL ab( ldab, * )
158 * ..
159 *
160 * =====================================================================
161 *
162 * .. Parameters ..
163  REAL one, zero
164  parameter( one = 1.0e+0, zero = 0.0e+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  REAL temp
172 * ..
173 * .. Local Arrays ..
174  REAL work13( ldwork, nbmax ),
175  $ work31( ldwork, nbmax )
176 * ..
177 * .. External Functions ..
178  INTEGER ilaenv, isamax
179  EXTERNAL ilaenv, isamax
180 * ..
181 * .. External Subroutines ..
182  EXTERNAL scopy, sgbtf2, sgemm, sger, slaswp, sscal,
183  $ sswap, strsm, 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( 'SGBTRF', -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, 'SGBTRF', ' ', 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 sgbtf2( 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 = isamax( 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 sswap( 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 sswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
322  $ work31( jp+jj-j-kl, 1 ), ldwork )
323  CALL sswap( 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 sscal( 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 sger( 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 scopy( 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 SLASWP to apply the row interchanges to A12, A22, and
366 * A32.
367 *
368  CALL slaswp( 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 strsm( '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 sgemm( '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 sgemm( '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 strsm( '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 sgemm( '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 sgemm( '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 sswap( 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 sswap( 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 scopy( 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 SGBTRF
515 *
subroutine sger(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
SGER
Definition: sger.f:132
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine sgbtf2(M, N, KL, KU, AB, LDAB, IPIV, INFO)
SGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algo...
Definition: sgbtf2.f:147
subroutine strsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRSM
Definition: strsm.f:183
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:189
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine slaswp(N, A, LDA, K1, K2, IPIV, INCX)
SLASWP performs a series of row interchanges on a general rectangular matrix.
Definition: slaswp.f:116

Here is the call graph for this function:

Here is the caller graph for this function:

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

SGBTRS

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

Purpose:
 SGBTRS 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 SGBTRF.
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 REAL array, dimension (LDAB,N)
          Details of the LU factorization of the band matrix A, as
          computed by SGBTRF.  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 REAL 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 sgbtrs.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  REAL ab( ldab, * ), b( ldb, * )
153 * ..
154 *
155 * =====================================================================
156 *
157 * .. Parameters ..
158  REAL one
159  parameter( one = 1.0e+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 sgemv, sger, sswap, stbsv, 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( 'SGBTRS', -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 sswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
227  CALL sger( 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 stbsv( '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 stbsv( '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 sgemv( '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 sswap( nrhs, b( l, 1 ), ldb, b( j, 1 ), ldb )
262  40 CONTINUE
263  END IF
264  END IF
265  RETURN
266 *
267 * End of SGBTRS
268 *
subroutine sgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGEMV
Definition: sgemv.f:158
subroutine sger(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
SGER
Definition: sger.f:132
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine stbsv(UPLO, TRANS, DIAG, N, K, A, LDA, X, INCX)
STBSV
Definition: stbsv.f:191

Here is the call graph for this function:

Here is the caller graph for this function:

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

SGGBAK

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

Purpose:
 SGGBAK 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
 SGGBAL.
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 SGGBAL.
[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 SGGBAL.
          1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
[in]LSCALE
          LSCALE is REAL array, dimension (N)
          Details of the permutations and/or scaling factors applied
          to the left side of A and B, as returned by SGGBAL.
[in]RSCALE
          RSCALE is REAL array, dimension (N)
          Details of the permutations and/or scaling factors applied
          to the right side of A and B, as returned by SGGBAL.
[in]M
          M is INTEGER
          The number of columns of the matrix V.  M >= 0.
[in,out]V
          V is REAL array, dimension (LDV,M)
          On entry, the matrix of right or left eigenvectors to be
          transformed, as returned by STGEVC.
          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 2011
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 sggbak.f.

149 *
150 * -- LAPACK computational routine (version 3.4.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 2011
154 *
155 * .. Scalar Arguments ..
156  CHARACTER job, side
157  INTEGER ihi, ilo, info, ldv, m, n
158 * ..
159 * .. Array Arguments ..
160  REAL 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 sscal, sswap, xerbla
175 * ..
176 * .. Intrinsic Functions ..
177  INTRINSIC max
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( 'SGGBAK', -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 sscal( 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 sscal( 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 = rscale( i )
259  IF( k.EQ.i )
260  $ GO TO 40
261  CALL sswap( 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 = rscale( i )
269  IF( k.EQ.i )
270  $ GO TO 60
271  CALL sswap( 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 = lscale( i )
283  IF( k.EQ.i )
284  $ GO TO 80
285  CALL sswap( 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 = lscale( i )
293  IF( k.EQ.i )
294  $ GO TO 100
295  CALL sswap( 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 SGGBAK
305 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function:

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

SGGBAL

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

Purpose:
 SGGBAL 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 REAL 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 REAL 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 REAL 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 REAL 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 REAL 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 2011
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 sggbal.f.

179 *
180 * -- LAPACK computational routine (version 3.4.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 2011
184 *
185 * .. Scalar Arguments ..
186  CHARACTER job
187  INTEGER ihi, ilo, info, lda, ldb, n
188 * ..
189 * .. Array Arguments ..
190  REAL a( lda, * ), b( ldb, * ), lscale( * ),
191  $ rscale( * ), work( * )
192 * ..
193 *
194 * =====================================================================
195 *
196 * .. Parameters ..
197  REAL zero, half, one
198  parameter( zero = 0.0e+0, half = 0.5e+0, one = 1.0e+0 )
199  REAL three, sclfac
200  parameter( three = 3.0e+0, sclfac = 1.0e+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  REAL 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 isamax
213  REAL sdot, slamch
214  EXTERNAL lsame, isamax, sdot, slamch
215 * ..
216 * .. External Subroutines ..
217  EXTERNAL saxpy, sscal, sswap, xerbla
218 * ..
219 * .. Intrinsic Functions ..
220  INTRINSIC abs, int, log10, max, min, REAL, 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( 'SGGBAL', -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 sswap( n-k+1, a( i, k ), lda, a( m, k ), lda )
347  CALL sswap( 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 sswap( l, a( 1, j ), 1, a( 1, m ), 1 )
356  CALL sswap( 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 / REAL( 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 = sdot( nr, work( ilo+4*n ), 1, work( ilo+4*n ), 1 ) +
423  $ sdot( 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 sscal( nr, beta, work( ilo ), 1 )
441  CALL sscal( nr, beta, work( ilo+n ), 1 )
442 *
443  CALL saxpy( nr, coef, work( ilo+4*n ), 1, work( ilo+n ), 1 )
444  CALL saxpy( 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 ) = REAL( 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 ) = REAL( kount )*work( j ) + sum
485  330 CONTINUE
486 *
487  sum = sdot( nr, work( ilo+n ), 1, work( ilo+2*n ), 1 ) +
488  $ sdot( 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 saxpy( nr, -alpha, work( ilo+2*n ), 1, work( ilo+4*n ), 1 )
508  CALL saxpy( 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 = slamch( '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 = isamax( n-ilo+1, a( i, ilo ), lda )
524  rab = abs( a( i, irab+ilo-1 ) )
525  irab = isamax( 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 = lscale( i ) + sign( half, lscale( i ) )
529  ir = min( max( ir, lsfmin ), lsfmax, lsfmax-lrab )
530  lscale( i ) = sclfac**ir
531  icab = isamax( ihi, a( 1, i ), 1 )
532  cab = abs( a( icab, i ) )
533  icab = isamax( ihi, b( 1, i ), 1 )
534  cab = max( cab, abs( b( icab, i ) ) )
535  lcab = int( log10( cab+sfmin ) / basl+one )
536  jc = 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 sscal( n-ilo+1, lscale( i ), a( i, ilo ), lda )
545  CALL sscal( 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 sscal( ihi, rscale( j ), a( 1, j ), 1 )
552  CALL sscal( ihi, rscale( j ), b( 1, j ), 1 )
553  380 CONTINUE
554 *
555  RETURN
556 *
557 * End of SGGBAL
558 *
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
integer function isamax(N, SX, INCX)
ISAMAX
Definition: isamax.f:53
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP
Definition: sswap.f:53
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55
real function sdot(N, SX, INCX, SY, INCY)
SDOT
Definition: sdot.f:53

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

Purpose:
    SLA_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 REAL 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 REAL array, dimension (LDAFB,N)
     Details of the LU factorization of the band matrix A, as
     computed by SGBTRF.  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 SGBTRF; 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 REAL 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 REAL 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 170 of file sla_gbrcond.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

SLA_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 SLA_GBRFSX_EXTENDED + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 SLA_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 SGBRFSX 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 REAL array, dimension (LDAB,N)
     On entry, the N-by-N matrix AB.
[in]LDAB
          LDAB is INTEGER
     The leading dimension of the array AB.  LDAB >= max(1,N).
[in]AFB
          AFB is REAL array, dimension (LDAFB,N)
     The factors L and U from the factorization
     A = P*L*U as computed by SGBTRF.
[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 SGBTRF; 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 REAL 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 REAL 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 REAL array, dimension (LDY,NRHS)
     On entry, the solution matrix X, as computed by SGBTRS.
     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 REAL 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 SLA_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 REAL 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 REAL 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 REAL array, dimension (N)
     Workspace to hold the intermediate residual.
[in]AYB
          AYB is REAL array, dimension (N)
     Workspace. This can be the same workspace passed for Y_TAIL.
[in]DY
          DY is REAL array, dimension (N)
     Workspace to hold the intermediate solution.
[in]Y_TAIL
          Y_TAIL is REAL array, dimension (N)
     Workspace to hold the trailing bits of the intermediate solution.
[in]RCOND
          RCOND is REAL
     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 REAL
     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 REAL
     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 SGBTRS had an illegal
             value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 414 of file sla_gbrfsx_extended.f.

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

Here is the call graph for this function:

Here is the caller graph for this function:

real function sla_gbrpvgrw ( integer  N,
integer  KL,
integer  KU,
integer  NCOLS,
real, dimension( ldab, * )  AB,
integer  LDAB,
real, dimension( ldafb, * )  AFB,
integer  LDAFB 
)

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

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

Purpose:
 SLA_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 REAL 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 REAL array, dimension (LDAFB,N)
     Details of the LU factorization of the band matrix A, as
     computed by SGBTRF.  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 sla_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  REAL ab( ldab, * ), afb( ldafb, * )
130 * ..
131 *
132 * =====================================================================
133 *
134 * .. Local Scalars ..
135  INTEGER i, j, kd
136  REAL amax, umax, rpvgrw
137 * ..
138 * .. Intrinsic Functions ..
139  INTRINSIC abs, max, min
140 * ..
141 * .. Executable Statements ..
142 *
143  rpvgrw = 1.0
144 
145  kd = ku + 1
146  DO j = 1, ncols
147  amax = 0.0
148  umax = 0.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.0 ) THEN
156  rpvgrw = min( amax / umax, rpvgrw )
157  END IF
158  END DO
159  sla_gbrpvgrw = rpvgrw
real function sla_gbrpvgrw(N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB)
SLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix...
Definition: sla_gbrpvgrw.f:119

Here is the caller graph for this function:

subroutine sorgbr ( character  VECT,
integer  M,
integer  N,
integer  K,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  TAU,
real, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

SORGBR

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

Purpose:
 SORGBR generates one of the real orthogonal matrices Q or P**T
 determined by SGEBRD 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 SORGBR returns the first n
 columns of Q, where m >= n >= k;
 if m < k, Q = H(1) H(2) . . . H(m-1) and SORGBR 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 SORGBR 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 SORGBR 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 SGEBRD:
          = '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 SGEBRD.
          If VECT = 'P', the number of rows in the original K-by-N
          matrix reduced by SGEBRD.
          K >= 0.
[in,out]A
          A is REAL array, dimension (LDA,N)
          On entry, the vectors which define the elementary reflectors,
          as returned by SGEBRD.
          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 REAL 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 SGEBRD in its array argument TAUQ or TAUP.
[out]WORK
          WORK is REAL 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 sorgbr.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  REAL a( lda, * ), tau( * ), work( * )
171 * ..
172 *
173 * =====================================================================
174 *
175 * .. Parameters ..
176  REAL zero, one
177  parameter( zero = 0.0e+0, one = 1.0e+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 ilaenv, lsame
187 * ..
188 * .. External Subroutines ..
189  EXTERNAL sorglq, sorgqr, 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 sorgqr( m, n, k, a, lda, tau, work, -1, iinfo )
223  ELSE
224  IF( m.GT.1 ) THEN
225  CALL sorgqr( 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 sorglq( m, n, k, a, lda, tau, work, -1, iinfo )
232  ELSE
233  IF( n.GT.1 ) THEN
234  CALL sorglq( 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( 'SORGBR', -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 SGEBRD 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 sorgqr( 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 sorgqr( 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 SGEBRD 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 sorglq( 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 sorglq( 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 SORGBR
337 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine sorgqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
SORGQR
Definition: sorgqr.f:130
subroutine sorglq(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
SORGLQ
Definition: sorglq.f:129

Here is the call graph for this function:

Here is the caller graph for this function: