042cff222a3f9887cfd2f5273ba69f2093e8cbfb
[platform/upstream/lapack.git] / SRC / sla_gerpvgrw.f
1 *> \brief \b SLA_GERPVGRW
2 *
3 *  =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at 
6 *            http://www.netlib.org/lapack/explore-html/ 
7 *
8 *> \htmlonly
9 *> Download SLA_GERPVGRW + dependencies 
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sla_gerpvgrw.f"> 
11 *> [TGZ]</a> 
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sla_gerpvgrw.f"> 
13 *> [ZIP]</a> 
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sla_gerpvgrw.f"> 
15 *> [TXT]</a>
16 *> \endhtmlonly 
17 *
18 *  Definition:
19 *  ===========
20 *
21 *       REAL FUNCTION SLA_GERPVGRW( N, NCOLS, A, LDA, AF, LDAF )
22
23 *       .. Scalar Arguments ..
24 *       INTEGER            N, NCOLS, LDA, LDAF
25 *       ..
26 *       .. Array Arguments ..
27 *       REAL               A( LDA, * ), AF( LDAF, * )
28 *       ..
29 *  
30 *
31 *> \par Purpose:
32 *  =============
33 *>
34 *> \verbatim
35 *>
36 *> SLA_GERPVGRW computes the reciprocal pivot growth factor
37 *> norm(A)/norm(U). The "max absolute element" norm is used. If this is
38 *> much less than 1, the stability of the LU factorization of the
39 *> (equilibrated) matrix A could be poor. This also means that the
40 *> solution X, estimated condition numbers, and error bounds could be
41 *> unreliable.
42 *> \endverbatim
43 *
44 *  Arguments:
45 *  ==========
46 *
47 *> \param[in] N
48 *> \verbatim
49 *>          N is INTEGER
50 *>     The number of linear equations, i.e., the order of the
51 *>     matrix A.  N >= 0.
52 *> \endverbatim
53 *>
54 *> \param[in] NCOLS
55 *> \verbatim
56 *>          NCOLS is INTEGER
57 *>     The number of columns of the matrix A. NCOLS >= 0.
58 *> \endverbatim
59 *>
60 *> \param[in] A
61 *> \verbatim
62 *>          A is REAL array, dimension (LDA,N)
63 *>     On entry, the N-by-N matrix A.
64 *> \endverbatim
65 *>
66 *> \param[in] LDA
67 *> \verbatim
68 *>          LDA is INTEGER
69 *>     The leading dimension of the array A.  LDA >= max(1,N).
70 *> \endverbatim
71 *>
72 *> \param[in] AF
73 *> \verbatim
74 *>          AF is REAL array, dimension (LDAF,N)
75 *>     The factors L and U from the factorization
76 *>     A = P*L*U as computed by SGETRF.
77 *> \endverbatim
78 *>
79 *> \param[in] LDAF
80 *> \verbatim
81 *>          LDAF is INTEGER
82 *>     The leading dimension of the array AF.  LDAF >= max(1,N).
83 *> \endverbatim
84 *
85 *  Authors:
86 *  ========
87 *
88 *> \author Univ. of Tennessee 
89 *> \author Univ. of California Berkeley 
90 *> \author Univ. of Colorado Denver 
91 *> \author NAG Ltd. 
92 *
93 *> \date November 2011
94 *
95 *> \ingroup realGEcomputational
96 *
97 *  =====================================================================
98       REAL FUNCTION SLA_GERPVGRW( N, NCOLS, A, LDA, AF, LDAF )
99 *
100 *  -- LAPACK computational routine (version 3.4.0) --
101 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
102 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
103 *     November 2011
104 *
105 *     .. Scalar Arguments ..
106       INTEGER            N, NCOLS, LDA, LDAF
107 *     ..
108 *     .. Array Arguments ..
109       REAL               A( LDA, * ), AF( LDAF, * )
110 *     ..
111 *
112 *  =====================================================================
113 *
114 *     .. Local Scalars ..
115       INTEGER            I, J
116       REAL               AMAX, UMAX, RPVGRW
117 *     ..
118 *     .. Intrinsic Functions ..
119       INTRINSIC          ABS, MAX, MIN
120 *     ..
121 *     .. Executable Statements ..
122 *
123       RPVGRW = 1.0
124
125       DO J = 1, NCOLS
126          AMAX = 0.0
127          UMAX = 0.0
128          DO I = 1, N
129             AMAX = MAX( ABS( A( I, J ) ), AMAX )
130          END DO
131          DO I = 1, J
132             UMAX = MAX( ABS( AF( I, J ) ), UMAX )
133          END DO
134          IF ( UMAX /= 0.0 ) THEN
135             RPVGRW = MIN( AMAX / UMAX, RPVGRW )
136          END IF
137       END DO
138       SLA_GERPVGRW = RPVGRW
139       END