LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
dpot03.f
Go to the documentation of this file.
1 *> \brief \b DPOT03
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE DPOT03( UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK,
12 * RWORK, RCOND, RESID )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER UPLO
16 * INTEGER LDA, LDAINV, LDWORK, N
17 * DOUBLE PRECISION RCOND, RESID
18 * ..
19 * .. Array Arguments ..
20 * DOUBLE PRECISION A( LDA, * ), AINV( LDAINV, * ), RWORK( * ),
21 * $ WORK( LDWORK, * )
22 * ..
23 *
24 *
25 *> \par Purpose:
26 * =============
27 *>
28 *> \verbatim
29 *>
30 *> DPOT03 computes the residual for a symmetric matrix times its
31 *> inverse:
32 *> norm( I - A*AINV ) / ( N * norm(A) * norm(AINV) * EPS ),
33 *> where EPS is the machine epsilon.
34 *> \endverbatim
35 *
36 * Arguments:
37 * ==========
38 *
39 *> \param[in] UPLO
40 *> \verbatim
41 *> UPLO is CHARACTER*1
42 *> Specifies whether the upper or lower triangular part of the
43 *> symmetric matrix A is stored:
44 *> = 'U': Upper triangular
45 *> = 'L': Lower triangular
46 *> \endverbatim
47 *>
48 *> \param[in] N
49 *> \verbatim
50 *> N is INTEGER
51 *> The number of rows and columns of the matrix A. N >= 0.
52 *> \endverbatim
53 *>
54 *> \param[in] A
55 *> \verbatim
56 *> A is DOUBLE PRECISION array, dimension (LDA,N)
57 *> The original symmetric matrix A.
58 *> \endverbatim
59 *>
60 *> \param[in] LDA
61 *> \verbatim
62 *> LDA is INTEGER
63 *> The leading dimension of the array A. LDA >= max(1,N)
64 *> \endverbatim
65 *>
66 *> \param[in,out] AINV
67 *> \verbatim
68 *> AINV is DOUBLE PRECISION array, dimension (LDAINV,N)
69 *> On entry, the inverse of the matrix A, stored as a symmetric
70 *> matrix in the same format as A.
71 *> In this version, AINV is expanded into a full matrix and
72 *> multiplied by A, so the opposing triangle of AINV will be
73 *> changed; i.e., if the upper triangular part of AINV is
74 *> stored, the lower triangular part will be used as work space.
75 *> \endverbatim
76 *>
77 *> \param[in] LDAINV
78 *> \verbatim
79 *> LDAINV is INTEGER
80 *> The leading dimension of the array AINV. LDAINV >= max(1,N).
81 *> \endverbatim
82 *>
83 *> \param[out] WORK
84 *> \verbatim
85 *> WORK is DOUBLE PRECISION array, dimension (LDWORK,N)
86 *> \endverbatim
87 *>
88 *> \param[in] LDWORK
89 *> \verbatim
90 *> LDWORK is INTEGER
91 *> The leading dimension of the array WORK. LDWORK >= max(1,N).
92 *> \endverbatim
93 *>
94 *> \param[out] RWORK
95 *> \verbatim
96 *> RWORK is DOUBLE PRECISION array, dimension (N)
97 *> \endverbatim
98 *>
99 *> \param[out] RCOND
100 *> \verbatim
101 *> RCOND is DOUBLE PRECISION
102 *> The reciprocal of the condition number of A, computed as
103 *> ( 1/norm(A) ) / norm(AINV).
104 *> \endverbatim
105 *>
106 *> \param[out] RESID
107 *> \verbatim
108 *> RESID is DOUBLE PRECISION
109 *> norm(I - A*AINV) / ( N * norm(A) * norm(AINV) * EPS )
110 *> \endverbatim
111 *
112 * Authors:
113 * ========
114 *
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
118 *> \author NAG Ltd.
119 *
120 *> \date November 2011
121 *
122 *> \ingroup double_lin
123 *
124 * =====================================================================
125  SUBROUTINE dpot03( UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK,
126  $ rwork, rcond, resid )
127 *
128 * -- LAPACK test routine (version 3.4.0) --
129 * -- LAPACK is a software package provided by Univ. of Tennessee, --
130 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131 * November 2011
132 *
133 * .. Scalar Arguments ..
134  CHARACTER UPLO
135  INTEGER LDA, LDAINV, LDWORK, N
136  DOUBLE PRECISION RCOND, RESID
137 * ..
138 * .. Array Arguments ..
139  DOUBLE PRECISION A( lda, * ), AINV( ldainv, * ), RWORK( * ),
140  $ work( ldwork, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  DOUBLE PRECISION ZERO, ONE
147  parameter ( zero = 0.0d+0, one = 1.0d+0 )
148 * ..
149 * .. Local Scalars ..
150  INTEGER I, J
151  DOUBLE PRECISION AINVNM, ANORM, EPS
152 * ..
153 * .. External Functions ..
154  LOGICAL LSAME
155  DOUBLE PRECISION DLAMCH, DLANGE, DLANSY
156  EXTERNAL lsame, dlamch, dlange, dlansy
157 * ..
158 * .. External Subroutines ..
159  EXTERNAL dsymm
160 * ..
161 * .. Intrinsic Functions ..
162  INTRINSIC dble
163 * ..
164 * .. Executable Statements ..
165 *
166 * Quick exit if N = 0.
167 *
168  IF( n.LE.0 ) THEN
169  rcond = one
170  resid = zero
171  RETURN
172  END IF
173 *
174 * Exit with RESID = 1/EPS if ANORM = 0 or AINVNM = 0.
175 *
176  eps = dlamch( 'Epsilon' )
177  anorm = dlansy( '1', uplo, n, a, lda, rwork )
178  ainvnm = dlansy( '1', uplo, n, ainv, ldainv, rwork )
179  IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
180  rcond = zero
181  resid = one / eps
182  RETURN
183  END IF
184  rcond = ( one / anorm ) / ainvnm
185 *
186 * Expand AINV into a full matrix and call DSYMM to multiply
187 * AINV on the left by A.
188 *
189  IF( lsame( uplo, 'U' ) ) THEN
190  DO 20 j = 1, n
191  DO 10 i = 1, j - 1
192  ainv( j, i ) = ainv( i, j )
193  10 CONTINUE
194  20 CONTINUE
195  ELSE
196  DO 40 j = 1, n
197  DO 30 i = j + 1, n
198  ainv( j, i ) = ainv( i, j )
199  30 CONTINUE
200  40 CONTINUE
201  END IF
202  CALL dsymm( 'Left', uplo, n, n, -one, a, lda, ainv, ldainv, zero,
203  $ work, ldwork )
204 *
205 * Add the identity matrix to WORK .
206 *
207  DO 50 i = 1, n
208  work( i, i ) = work( i, i ) + one
209  50 CONTINUE
210 *
211 * Compute norm(I - A*AINV) / (N * norm(A) * norm(AINV) * EPS)
212 *
213  resid = dlange( '1', n, n, work, ldwork, rwork )
214 *
215  resid = ( ( resid*rcond ) / eps ) / dble( n )
216 *
217  RETURN
218 *
219 * End of DPOT03
220 *
221  END
subroutine dsymm(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
DSYMM
Definition: dsymm.f:191
subroutine dpot03(UPLO, N, A, LDA, AINV, LDAINV, WORK, LDWORK, RWORK, RCOND, RESID)
DPOT03
Definition: dpot03.f:127