LAPACK 3.3.0

cla_porpvgrw.f

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