LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
 All Classes Files Functions Variables Typedefs Macros
cla_porpvgrw.f
Go to the documentation of this file.
1 *> \brief \b CLA_PORPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a symmetric or Hermitian positive-definite matrix.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download CLA_PORPVGRW + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_porpvgrw.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_porpvgrw.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_porpvgrw.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * REAL FUNCTION CLA_PORPVGRW( UPLO, NCOLS, A, LDA, AF, LDAF, WORK )
22 *
23 * .. Scalar Arguments ..
24 * CHARACTER*1 UPLO
25 * INTEGER NCOLS, LDA, LDAF
26 * ..
27 * .. Array Arguments ..
28 * COMPLEX A( LDA, * ), AF( LDAF, * )
29 * REAL WORK( * )
30 * ..
31 *
32 *
33 *> \par Purpose:
34 * =============
35 *>
36 *> \verbatim
37 *>
38 *>
39 *> CLA_PORPVGRW computes the reciprocal pivot growth factor
40 *> norm(A)/norm(U). The "max absolute element" norm is used. If this is
41 *> much less than 1, the stability of the LU factorization of the
42 *> (equilibrated) matrix A could be poor. This also means that the
43 *> solution X, estimated condition numbers, and error bounds could be
44 *> unreliable.
45 *> \endverbatim
46 *
47 * Arguments:
48 * ==========
49 *
50 *> \param[in] UPLO
51 *> \verbatim
52 *> UPLO is CHARACTER*1
53 *> = 'U': Upper triangle of A is stored;
54 *> = 'L': Lower triangle of A is stored.
55 *> \endverbatim
56 *>
57 *> \param[in] NCOLS
58 *> \verbatim
59 *> NCOLS is INTEGER
60 *> The number of columns of the matrix A. NCOLS >= 0.
61 *> \endverbatim
62 *>
63 *> \param[in] A
64 *> \verbatim
65 *> A is COMPLEX array, dimension (LDA,N)
66 *> On entry, the N-by-N matrix A.
67 *> \endverbatim
68 *>
69 *> \param[in] LDA
70 *> \verbatim
71 *> LDA is INTEGER
72 *> The leading dimension of the array A. LDA >= max(1,N).
73 *> \endverbatim
74 *>
75 *> \param[in] AF
76 *> \verbatim
77 *> AF is COMPLEX array, dimension (LDAF,N)
78 *> The triangular factor U or L from the Cholesky factorization
79 *> A = U**T*U or A = L*L**T, as computed by CPOTRF.
80 *> \endverbatim
81 *>
82 *> \param[in] LDAF
83 *> \verbatim
84 *> LDAF is INTEGER
85 *> The leading dimension of the array AF. LDAF >= max(1,N).
86 *> \endverbatim
87 *>
88 *> \param[in] WORK
89 *> \verbatim
90 *> WORK is COMPLEX array, dimension (2*N)
91 *> \endverbatim
92 *
93 * Authors:
94 * ========
95 *
96 *> \author Univ. of Tennessee
97 *> \author Univ. of California Berkeley
98 *> \author Univ. of Colorado Denver
99 *> \author NAG Ltd.
100 *
101 *> \date September 2012
102 *
103 *> \ingroup complexPOcomputational
104 *
105 * =====================================================================
106  REAL FUNCTION cla_porpvgrw( UPLO, NCOLS, A, LDA, AF, LDAF, WORK )
107 *
108 * -- LAPACK computational routine (version 3.4.2) --
109 * -- LAPACK is a software package provided by Univ. of Tennessee, --
110 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
111 * September 2012
112 *
113 * .. Scalar Arguments ..
114  CHARACTER*1 uplo
115  INTEGER ncols, lda, ldaf
116 * ..
117 * .. Array Arguments ..
118  COMPLEX a( lda, * ), af( ldaf, * )
119  REAL work( * )
120 * ..
121 *
122 * =====================================================================
123 *
124 * .. Local Scalars ..
125  INTEGER i, j
126  REAL amax, umax, rpvgrw
127  LOGICAL upper
128  COMPLEX zdum
129 * ..
130 * .. External Functions ..
131  EXTERNAL lsame, claset
132  LOGICAL lsame
133 * ..
134 * .. Intrinsic Functions ..
135  INTRINSIC abs, max, min, REAL, aimag
136 * ..
137 * .. Statement Functions ..
138  REAL cabs1
139 * ..
140 * .. Statement Function Definitions ..
141  cabs1( zdum ) = abs( REAL( ZDUM ) ) + abs( aimag( zdum ) )
142 * ..
143 * .. Executable Statements ..
144  upper = lsame( 'Upper', uplo )
145 *
146 * SPOTRF will have factored only the NCOLSxNCOLS leading minor, so
147 * we restrict the growth search to that minor and use only the first
148 * 2*NCOLS workspace entries.
149 *
150  rpvgrw = 1.0
151  DO i = 1, 2*ncols
152  work( i ) = 0.0
153  END DO
154 *
155 * Find the max magnitude entry of each column.
156 *
157  IF ( upper ) THEN
158  DO j = 1, ncols
159  DO i = 1, j
160  work( ncols+j ) =
161  $ max( cabs1( a( i, j ) ), work( ncols+j ) )
162  END DO
163  END DO
164  ELSE
165  DO j = 1, ncols
166  DO i = j, ncols
167  work( ncols+j ) =
168  $ max( cabs1( a( i, j ) ), work( ncols+j ) )
169  END DO
170  END DO
171  END IF
172 *
173 * Now find the max magnitude entry of each column of the factor in
174 * AF. No pivoting, so no permutations.
175 *
176  IF ( lsame( 'Upper', uplo ) ) THEN
177  DO j = 1, ncols
178  DO i = 1, j
179  work( j ) = max( cabs1( af( i, j ) ), work( j ) )
180  END DO
181  END DO
182  ELSE
183  DO j = 1, ncols
184  DO i = j, ncols
185  work( j ) = max( cabs1( af( i, j ) ), work( j ) )
186  END DO
187  END DO
188  END IF
189 *
190 * Compute the *inverse* of the max element growth factor. Dividing
191 * by zero would imply the largest entry of the factor's column is
192 * zero. Than can happen when either the column of A is zero or
193 * massive pivots made the factor underflow to zero. Neither counts
194 * as growth in itself, so simply ignore terms with zero
195 * denominators.
196 *
197  IF ( lsame( 'Upper', uplo ) ) THEN
198  DO i = 1, ncols
199  umax = work( i )
200  amax = work( ncols+i )
201  IF ( umax /= 0.0 ) THEN
202  rpvgrw = min( amax / umax, rpvgrw )
203  END IF
204  END DO
205  ELSE
206  DO i = 1, ncols
207  umax = work( i )
208  amax = work( ncols+i )
209  IF ( umax /= 0.0 ) THEN
210  rpvgrw = min( amax / umax, rpvgrw )
211  END IF
212  END DO
213  END IF
214 
215  cla_porpvgrw = rpvgrw
216  END