LAPACK 3.3.0

sla_porpvgrw.f

Go to the documentation of this file.
00001       REAL FUNCTION SLA_PORPVGRW( UPLO, NCOLS, A, LDA, AF, LDAF, WORK )
00002 *
00003 *     -- LAPACK routine (version 3.2.2)                                 --
00004 *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
00005 *     -- Jason Riedy of Univ. of California Berkeley.                 --
00006 *     -- June 2010                                                    --
00007 *
00008 *     -- LAPACK is a software package provided by Univ. of Tennessee, --
00009 *     -- Univ. of California Berkeley and NAG Ltd.                    --
00010 *
00011       IMPLICIT NONE
00012 *     ..
00013 *     .. Scalar Arguments ..
00014       CHARACTER*1        UPLO
00015       INTEGER            NCOLS, LDA, LDAF
00016 *     ..
00017 *     .. Array Arguments ..
00018       REAL               A( LDA, * ), AF( LDAF, * ), WORK( * )
00019 *     ..
00020 *
00021 *  Purpose
00022 *  =======
00023 * 
00024 *  SLA_PORPVGRW computes the reciprocal pivot growth factor
00025 *  norm(A)/norm(U). The "max absolute element" norm is used. If this is
00026 *  much less than 1, the stability of the LU factorization of the
00027 *  (equilibrated) matrix A could be poor. This also means that the
00028 *  solution X, estimated condition numbers, and error bounds could be
00029 *  unreliable.
00030 *
00031 *  Arguments
00032 *  =========
00033 *
00034 *     UPLO    (input) CHARACTER*1
00035 *       = 'U':  Upper triangle of A is stored;
00036 *       = 'L':  Lower triangle of A is stored.
00037 *
00038 *     NCOLS   (input) INTEGER
00039 *     The number of columns of the matrix A. NCOLS >= 0.
00040 *
00041 *     A       (input) REAL array, dimension (LDA,N)
00042 *     On entry, the N-by-N matrix A.
00043 *
00044 *     LDA     (input) INTEGER
00045 *     The leading dimension of the array A.  LDA >= max(1,N).
00046 *
00047 *     AF      (input) REAL array, dimension (LDAF,N)
00048 *     The triangular factor U or L from the Cholesky factorization
00049 *     A = U**T*U or A = L*L**T, as computed by SPOTRF.
00050 *
00051 *     LDAF    (input) INTEGER
00052 *     The leading dimension of the array AF.  LDAF >= max(1,N).
00053 *
00054 *     WORK    (input) REAL array, dimension (2*N)
00055 *
00056 *  =====================================================================
00057 *
00058 *     .. Local Scalars ..
00059       INTEGER            I, J
00060       REAL               AMAX, UMAX, RPVGRW
00061       LOGICAL            UPPER
00062 *     ..
00063 *     .. Intrinsic Functions ..
00064       INTRINSIC          ABS, MAX, MIN
00065 *     ..
00066 *     .. External Functions ..
00067       EXTERNAL           LSAME, SLASET
00068       LOGICAL            LSAME
00069 *     ..
00070 *     .. Executable Statements ..
00071 *
00072       UPPER = LSAME( 'Upper', UPLO )
00073 *
00074 *     SPOTRF will have factored only the NCOLSxNCOLS leading minor, so
00075 *     we restrict the growth search to that minor and use only the first
00076 *     2*NCOLS workspace entries.
00077 *
00078       RPVGRW = 1.0
00079       DO I = 1, 2*NCOLS
00080          WORK( I ) = 0.0
00081       END DO
00082 *
00083 *     Find the max magnitude entry of each column.
00084 *
00085       IF ( UPPER ) THEN
00086          DO J = 1, NCOLS
00087             DO I = 1, J
00088                WORK( NCOLS+J ) =
00089      $              MAX( ABS( A( I, J ) ), WORK( NCOLS+J ) )
00090             END DO
00091          END DO
00092       ELSE
00093          DO J = 1, NCOLS
00094             DO I = J, NCOLS
00095                WORK( NCOLS+J ) =
00096      $              MAX( ABS( A( I, J ) ), WORK( NCOLS+J ) )
00097             END DO
00098          END DO
00099       END IF
00100 *
00101 *     Now find the max magnitude entry of each column of the factor in
00102 *     AF.  No pivoting, so no permutations.
00103 *
00104       IF ( LSAME( 'Upper', UPLO ) ) THEN
00105          DO J = 1, NCOLS
00106             DO I = 1, J
00107                WORK( J ) = MAX( ABS( AF( I, J ) ), WORK( J ) )
00108             END DO
00109          END DO
00110       ELSE
00111          DO J = 1, NCOLS
00112             DO I = J, NCOLS
00113                WORK( J ) = MAX( ABS( AF( I, J ) ), WORK( J ) )
00114             END DO
00115          END DO
00116       END IF
00117 *
00118 *     Compute the *inverse* of the max element growth factor.  Dividing
00119 *     by zero would imply the largest entry of the factor's column is
00120 *     zero.  Than can happen when either the column of A is zero or
00121 *     massive pivots made the factor underflow to zero.  Neither counts
00122 *     as growth in itself, so simply ignore terms with zero
00123 *     denominators.
00124 *
00125       IF ( LSAME( 'Upper', UPLO ) ) THEN
00126          DO I = 1, NCOLS
00127             UMAX = WORK( I )
00128             AMAX = WORK( NCOLS+I )
00129             IF ( UMAX /= 0.0 ) THEN
00130                RPVGRW = MIN( AMAX / UMAX, RPVGRW )
00131             END IF
00132          END DO
00133       ELSE
00134          DO I = 1, NCOLS
00135             UMAX = WORK( I )
00136             AMAX = WORK( NCOLS+I )
00137             IF ( UMAX /= 0.0 ) THEN
00138                RPVGRW = MIN( AMAX / UMAX, RPVGRW )
00139             END IF
00140          END DO
00141       END IF
00142 
00143       SLA_PORPVGRW = RPVGRW
00144       END
 All Files Functions