LAPACK  3.9.1
LAPACK: Linear Algebra PACKage
cla_porcond_x.f
Go to the documentation of this file.
1 *> \brief \b CLA_PORCOND_X computes the infinity norm condition number of op(A)*diag(x) for Hermitian positive-definite matrices.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download CLA_PORCOND_X + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_porcond_x.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_porcond_x.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_porcond_x.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * REAL FUNCTION CLA_PORCOND_X( UPLO, N, A, LDA, AF, LDAF, X, INFO,
22 * WORK, RWORK )
23 *
24 * .. Scalar Arguments ..
25 * CHARACTER UPLO
26 * INTEGER N, LDA, LDAF, INFO
27 * ..
28 * .. Array Arguments ..
29 * COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * ), X( * )
30 * REAL RWORK( * )
31 * ..
32 *
33 *
34 *> \par Purpose:
35 * =============
36 *>
37 *> \verbatim
38 *>
39 *> CLA_PORCOND_X Computes the infinity norm condition number of
40 *> op(A) * diag(X) where X is a COMPLEX vector.
41 *> \endverbatim
42 *
43 * Arguments:
44 * ==========
45 *
46 *> \param[in] UPLO
47 *> \verbatim
48 *> UPLO is CHARACTER*1
49 *> = 'U': Upper triangle of A is stored;
50 *> = 'L': Lower triangle of A is stored.
51 *> \endverbatim
52 *>
53 *> \param[in] N
54 *> \verbatim
55 *> N is INTEGER
56 *> The number of linear equations, i.e., the order of the
57 *> matrix A. N >= 0.
58 *> \endverbatim
59 *>
60 *> \param[in] A
61 *> \verbatim
62 *> A is COMPLEX 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 COMPLEX array, dimension (LDAF,N)
75 *> The triangular factor U or L from the Cholesky factorization
76 *> A = U**H*U or A = L*L**H, as computed by CPOTRF.
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 *> \param[in] X
86 *> \verbatim
87 *> X is COMPLEX array, dimension (N)
88 *> The vector X in the formula op(A) * diag(X).
89 *> \endverbatim
90 *>
91 *> \param[out] INFO
92 *> \verbatim
93 *> INFO is INTEGER
94 *> = 0: Successful exit.
95 *> i > 0: The ith argument is invalid.
96 *> \endverbatim
97 *>
98 *> \param[out] WORK
99 *> \verbatim
100 *> WORK is COMPLEX array, dimension (2*N).
101 *> Workspace.
102 *> \endverbatim
103 *>
104 *> \param[out] RWORK
105 *> \verbatim
106 *> RWORK is REAL array, dimension (N).
107 *> Workspace.
108 *> \endverbatim
109 *
110 * Authors:
111 * ========
112 *
113 *> \author Univ. of Tennessee
114 *> \author Univ. of California Berkeley
115 *> \author Univ. of Colorado Denver
116 *> \author NAG Ltd.
117 *
118 *> \ingroup complexPOcomputational
119 *
120 * =====================================================================
121  REAL function cla_porcond_x( uplo, n, a, lda, af, ldaf, x, info,
122  $ work, rwork )
123 *
124 * -- LAPACK computational routine --
125 * -- LAPACK is a software package provided by Univ. of Tennessee, --
126 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
127 *
128 * .. Scalar Arguments ..
129  CHARACTER uplo
130  INTEGER n, lda, ldaf, info
131 * ..
132 * .. Array Arguments ..
133  COMPLEX a( lda, * ), af( ldaf, * ), work( * ), x( * )
134  REAL rwork( * )
135 * ..
136 *
137 * =====================================================================
138 *
139 * .. Local Scalars ..
140  INTEGER kase, i, j
141  REAL ainvnm, anorm, tmp
142  LOGICAL up, upper
143  COMPLEX zdum
144 * ..
145 * .. Local Arrays ..
146  INTEGER isave( 3 )
147 * ..
148 * .. External Functions ..
149  LOGICAL lsame
150  EXTERNAL lsame
151 * ..
152 * .. External Subroutines ..
153  EXTERNAL clacn2, cpotrs, xerbla
154 * ..
155 * .. Intrinsic Functions ..
156  INTRINSIC abs, max, real, aimag
157 * ..
158 * .. Statement Functions ..
159  REAL cabs1
160 * ..
161 * .. Statement Function Definitions ..
162  cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
163 * ..
164 * .. Executable Statements ..
165 *
166  cla_porcond_x = 0.0e+0
167 *
168  info = 0
169  upper = lsame( uplo, 'U' )
170  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
171  info = -1
172  ELSE IF ( n.LT.0 ) THEN
173  info = -2
174  ELSE IF( lda.LT.max( 1, n ) ) THEN
175  info = -4
176  ELSE IF( ldaf.LT.max( 1, n ) ) THEN
177  info = -6
178  END IF
179  IF( info.NE.0 ) THEN
180  CALL xerbla( 'CLA_PORCOND_X', -info )
181  RETURN
182  END IF
183  up = .false.
184  IF ( lsame( uplo, 'U' ) ) up = .true.
185 *
186 * Compute norm of op(A)*op2(C).
187 *
188  anorm = 0.0
189  IF ( up ) THEN
190  DO i = 1, n
191  tmp = 0.0e+0
192  DO j = 1, i
193  tmp = tmp + cabs1( a( j, i ) * x( j ) )
194  END DO
195  DO j = i+1, n
196  tmp = tmp + cabs1( a( i, j ) * x( j ) )
197  END DO
198  rwork( i ) = tmp
199  anorm = max( anorm, tmp )
200  END DO
201  ELSE
202  DO i = 1, n
203  tmp = 0.0e+0
204  DO j = 1, i
205  tmp = tmp + cabs1( a( i, j ) * x( j ) )
206  END DO
207  DO j = i+1, n
208  tmp = tmp + cabs1( a( j, i ) * x( j ) )
209  END DO
210  rwork( i ) = tmp
211  anorm = max( anorm, tmp )
212  END DO
213  END IF
214 *
215 * Quick return if possible.
216 *
217  IF( n.EQ.0 ) THEN
218  cla_porcond_x = 1.0e+0
219  RETURN
220  ELSE IF( anorm .EQ. 0.0e+0 ) THEN
221  RETURN
222  END IF
223 *
224 * Estimate the norm of inv(op(A)).
225 *
226  ainvnm = 0.0e+0
227 *
228  kase = 0
229  10 CONTINUE
230  CALL clacn2( n, work( n+1 ), work, ainvnm, kase, isave )
231  IF( kase.NE.0 ) THEN
232  IF( kase.EQ.2 ) THEN
233 *
234 * Multiply by R.
235 *
236  DO i = 1, n
237  work( i ) = work( i ) * rwork( i )
238  END DO
239 *
240  IF ( up ) THEN
241  CALL cpotrs( 'U', n, 1, af, ldaf,
242  $ work, n, info )
243  ELSE
244  CALL cpotrs( 'L', n, 1, af, ldaf,
245  $ work, n, info )
246  ENDIF
247 *
248 * Multiply by inv(X).
249 *
250  DO i = 1, n
251  work( i ) = work( i ) / x( i )
252  END DO
253  ELSE
254 *
255 * Multiply by inv(X**H).
256 *
257  DO i = 1, n
258  work( i ) = work( i ) / x( i )
259  END DO
260 *
261  IF ( up ) THEN
262  CALL cpotrs( 'U', n, 1, af, ldaf,
263  $ work, n, info )
264  ELSE
265  CALL cpotrs( 'L', n, 1, af, ldaf,
266  $ work, n, info )
267  END IF
268 *
269 * Multiply by R.
270 *
271  DO i = 1, n
272  work( i ) = work( i ) * rwork( i )
273  END DO
274  END IF
275  GO TO 10
276  END IF
277 *
278 * Compute the estimate of the reciprocal condition number.
279 *
280  IF( ainvnm .NE. 0.0e+0 )
281  $ cla_porcond_x = 1.0e+0 / ainvnm
282 *
283  RETURN
284 *
285  END
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine clacn2(N, V, X, EST, KASE, ISAVE)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition: clacn2.f:133
real function cla_porcond_x(UPLO, N, A, LDA, AF, LDAF, X, INFO, WORK, RWORK)
CLA_PORCOND_X computes the infinity norm condition number of op(A)*diag(x) for Hermitian positive-def...
subroutine cpotrs(UPLO, N, NRHS, A, LDA, B, LDB, INFO)
CPOTRS
Definition: cpotrs.f:110