LAPACK  3.10.0
LAPACK: Linear Algebra PACKage
ssyt01_3.f
Go to the documentation of this file.
1 *> \brief \b SSYT01_3
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 SSYT01_3( UPLO, N, A, LDA, AFAC, LDAFAC, E, IPIV, C,
12 * LDC, RWORK, RESID )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER UPLO
16 * INTEGER LDA, LDAFAC, LDC, N
17 * DOUBLE PRECISION RESID
18 * ..
19 * .. Array Arguments ..
20 * INTEGER IPIV( * )
21 * DOUBLE PRECISION A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * ),
22 * $ E( * ), RWORK( * )
23 * ..
24 *
25 *
26 *> \par Purpose:
27 * =============
28 *>
29 *> \verbatim
30 *>
31 *> SSYT01_3 reconstructs a symmetric indefinite matrix A from its
32 *> block L*D*L' or U*D*U' factorization computed by SSYTRF_RK
33 *> (or SSYTRF_BK) and computes the residual
34 *> norm( C - A ) / ( N * norm(A) * EPS ),
35 *> where C is the reconstructed matrix and EPS is the machine epsilon.
36 *> \endverbatim
37 *
38 * Arguments:
39 * ==========
40 *
41 *> \param[in] UPLO
42 *> \verbatim
43 *> UPLO is CHARACTER*1
44 *> Specifies whether the upper or lower triangular part of the
45 *> symmetric matrix A is stored:
46 *> = 'U': Upper triangular
47 *> = 'L': Lower triangular
48 *> \endverbatim
49 *>
50 *> \param[in] N
51 *> \verbatim
52 *> N is INTEGER
53 *> The number of rows and columns of the matrix A. N >= 0.
54 *> \endverbatim
55 *>
56 *> \param[in] A
57 *> \verbatim
58 *> A is DOUBLE PRECISION array, dimension (LDA,N)
59 *> The original symmetric matrix A.
60 *> \endverbatim
61 *>
62 *> \param[in] LDA
63 *> \verbatim
64 *> LDA is INTEGER
65 *> The leading dimension of the array A. LDA >= max(1,N)
66 *> \endverbatim
67 *>
68 *> \param[in] AFAC
69 *> \verbatim
70 *> AFAC is DOUBLE PRECISION array, dimension (LDAFAC,N)
71 *> Diagonal of the block diagonal matrix D and factors U or L
72 *> as computed by SSYTRF_RK and SSYTRF_BK:
73 *> a) ONLY diagonal elements of the symmetric block diagonal
74 *> matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
75 *> (superdiagonal (or subdiagonal) elements of D
76 *> should be provided on entry in array E), and
77 *> b) If UPLO = 'U': factor U in the superdiagonal part of A.
78 *> If UPLO = 'L': factor L in the subdiagonal part of A.
79 *> \endverbatim
80 *>
81 *> \param[in] LDAFAC
82 *> \verbatim
83 *> LDAFAC is INTEGER
84 *> The leading dimension of the array AFAC.
85 *> LDAFAC >= max(1,N).
86 *> \endverbatim
87 *>
88 *> \param[in] E
89 *> \verbatim
90 *> E is DOUBLE PRECISION array, dimension (N)
91 *> On entry, contains the superdiagonal (or subdiagonal)
92 *> elements of the symmetric block diagonal matrix D
93 *> with 1-by-1 or 2-by-2 diagonal blocks, where
94 *> If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not referenced;
95 *> If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced.
96 *> \endverbatim
97 *>
98 *> \param[in] IPIV
99 *> \verbatim
100 *> IPIV is INTEGER array, dimension (N)
101 *> The pivot indices from SSYTRF_RK (or SSYTRF_BK).
102 *> \endverbatim
103 *>
104 *> \param[out] C
105 *> \verbatim
106 *> C is DOUBLE PRECISION array, dimension (LDC,N)
107 *> \endverbatim
108 *>
109 *> \param[in] LDC
110 *> \verbatim
111 *> LDC is INTEGER
112 *> The leading dimension of the array C. LDC >= max(1,N).
113 *> \endverbatim
114 *>
115 *> \param[out] RWORK
116 *> \verbatim
117 *> RWORK is DOUBLE PRECISION array, dimension (N)
118 *> \endverbatim
119 *>
120 *> \param[out] RESID
121 *> \verbatim
122 *> RESID is DOUBLE PRECISION
123 *> If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
124 *> If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
125 *> \endverbatim
126 *
127 * Authors:
128 * ========
129 *
130 *> \author Univ. of Tennessee
131 *> \author Univ. of California Berkeley
132 *> \author Univ. of Colorado Denver
133 *> \author NAG Ltd.
134 *
135 *> \ingroup single_lin
136 *
137 * =====================================================================
138  SUBROUTINE ssyt01_3( UPLO, N, A, LDA, AFAC, LDAFAC, E, IPIV, C,
139  $ LDC, RWORK, RESID )
140 *
141 * -- LAPACK test routine --
142 * -- LAPACK is a software package provided by Univ. of Tennessee, --
143 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
144 *
145 * .. Scalar Arguments ..
146  CHARACTER UPLO
147  INTEGER LDA, LDAFAC, LDC, N
148  REAL RESID
149 * ..
150 * .. Array Arguments ..
151  INTEGER IPIV( * )
152  REAL A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * ),
153  $ e( * ), rwork( * )
154 * ..
155 *
156 * =====================================================================
157 *
158 * .. Parameters ..
159  REAL ZERO, ONE
160  parameter( zero = 0.0e+0, one = 1.0e+0 )
161 * ..
162 * .. Local Scalars ..
163  INTEGER I, INFO, J
164  REAL ANORM, EPS
165 * ..
166 * .. External Functions ..
167  LOGICAL LSAME
168  REAL SLAMCH, SLANSY
169  EXTERNAL lsame, slamch, slansy
170 * ..
171 * .. External Subroutines ..
172  EXTERNAL slaset, slavsy_rook, ssyconvf_rook
173 * ..
174 * .. Intrinsic Functions ..
175  INTRINSIC real
176 * ..
177 * .. Executable Statements ..
178 *
179 * Quick exit if N = 0.
180 *
181  IF( n.LE.0 ) THEN
182  resid = zero
183  RETURN
184  END IF
185 *
186 * a) Revert to multiplyers of L
187 *
188  CALL ssyconvf_rook( uplo, 'R', n, afac, ldafac, e, ipiv, info )
189 *
190 * 1) Determine EPS and the norm of A.
191 *
192  eps = slamch( 'Epsilon' )
193  anorm = slansy( '1', uplo, n, a, lda, rwork )
194 *
195 * 2) Initialize C to the identity matrix.
196 *
197  CALL slaset( 'Full', n, n, zero, one, c, ldc )
198 *
199 * 3) Call SLAVSY_ROOK to form the product D * U' (or D * L' ).
200 *
201  CALL slavsy_rook( uplo, 'Transpose', 'Non-unit', n, n, afac,
202  $ ldafac, ipiv, c, ldc, info )
203 *
204 * 4) Call SLAVSY_ROOK again to multiply by U (or L ).
205 *
206  CALL slavsy_rook( uplo, 'No transpose', 'Unit', n, n, afac,
207  $ ldafac, ipiv, c, ldc, info )
208 *
209 * 5) Compute the difference C - A.
210 *
211  IF( lsame( uplo, 'U' ) ) THEN
212  DO j = 1, n
213  DO i = 1, j
214  c( i, j ) = c( i, j ) - a( i, j )
215  END DO
216  END DO
217  ELSE
218  DO j = 1, n
219  DO i = j, n
220  c( i, j ) = c( i, j ) - a( i, j )
221  END DO
222  END DO
223  END IF
224 *
225 * 6) Compute norm( C - A ) / ( N * norm(A) * EPS )
226 *
227  resid = slansy( '1', uplo, n, c, ldc, rwork )
228 *
229  IF( anorm.LE.zero ) THEN
230  IF( resid.NE.zero )
231  $ resid = one / eps
232  ELSE
233  resid = ( ( resid / real( n ) ) / anorm ) / eps
234  END IF
235 
236 *
237 * b) Convert to factor of L (or U)
238 *
239  CALL ssyconvf_rook( uplo, 'C', n, afac, ldafac, e, ipiv, info )
240 *
241  RETURN
242 *
243 * End of SSYT01_3
244 *
245  END
subroutine slaset(UPLO, M, N, ALPHA, BETA, A, LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: slaset.f:110
subroutine ssyt01_3(UPLO, N, A, LDA, AFAC, LDAFAC, E, IPIV, C, LDC, RWORK, RESID)
SSYT01_3
Definition: ssyt01_3.f:140
subroutine slavsy_rook(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SLAVSY_ROOK
Definition: slavsy_rook.f:157
subroutine ssyconvf_rook(UPLO, WAY, N, A, LDA, E, IPIV, INFO)
SSYCONVF_ROOK