LAPACK  3.7.0
LAPACK: Linear Algebra PACKage
csyt01_aa.f
Go to the documentation of this file.
1 *> \brief \b CSYT01
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 CSYT01_AA( UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC,
12 * RWORK, RESID )
13 *
14 * .. Scalar Arguments ..
15 * CHARACTER UPLO
16 * INTEGER LDA, LDAFAC, LDC, N
17 * REAL RESID
18 * ..
19 * .. Array Arguments ..
20 * INTEGER IPIV( * )
21 * REAL RWORK( * )
22 * COMPLEX A( LDA, * ), AFAC( LDAFAC, * ), C( LDC, * )
23 * ..
24 *
25 *
26 *> \par Purpose:
27 * =============
28 *>
29 *> \verbatim
30 *>
31 *> CSYT01 reconstructs a hermitian indefinite matrix A from its
32 *> block L*D*L' or U*D*U' factorization and computes the residual
33 *> norm( C - A ) / ( N * norm(A) * EPS ),
34 *> where C is the reconstructed matrix and EPS is the machine epsilon.
35 *> \endverbatim
36 *
37 * Arguments:
38 * ==========
39 *
40 *> \param[in] UPLO
41 *> \verbatim
42 *> UPLO is CHARACTER*1
43 *> Specifies whether the upper or lower triangular part of the
44 *> hermitian matrix A is stored:
45 *> = 'U': Upper triangular
46 *> = 'L': Lower triangular
47 *> \endverbatim
48 *>
49 *> \param[in] N
50 *> \verbatim
51 *> N is INTEGER
52 *> The number of rows and columns of the matrix A. N >= 0.
53 *> \endverbatim
54 *>
55 *> \param[in] A
56 *> \verbatim
57 *> A is REAL array, dimension (LDA,N)
58 *> The original hermitian matrix A.
59 *> \endverbatim
60 *>
61 *> \param[in] LDA
62 *> \verbatim
63 *> LDA is INTEGER
64 *> The leading dimension of the array A. LDA >= max(1,N)
65 *> \endverbatim
66 *>
67 *> \param[in] AFAC
68 *> \verbatim
69 *> AFAC is REAL array, dimension (LDAFAC,N)
70 *> The factored form of the matrix A. AFAC contains the block
71 *> diagonal matrix D and the multipliers used to obtain the
72 *> factor L or U from the block L*D*L' or U*D*U' factorization
73 *> as computed by CSYTRF.
74 *> \endverbatim
75 *>
76 *> \param[in] LDAFAC
77 *> \verbatim
78 *> LDAFAC is INTEGER
79 *> The leading dimension of the array AFAC. LDAFAC >= max(1,N).
80 *> \endverbatim
81 *>
82 *> \param[in] IPIV
83 *> \verbatim
84 *> IPIV is INTEGER array, dimension (N)
85 *> The pivot indices from CSYTRF.
86 *> \endverbatim
87 *>
88 *> \param[out] C
89 *> \verbatim
90 *> C is REAL array, dimension (LDC,N)
91 *> \endverbatim
92 *>
93 *> \param[in] LDC
94 *> \verbatim
95 *> LDC is INTEGER
96 *> The leading dimension of the array C. LDC >= max(1,N).
97 *> \endverbatim
98 *>
99 *> \param[out] RWORK
100 *> \verbatim
101 *> RWORK is REAL array, dimension (N)
102 *> \endverbatim
103 *>
104 *> \param[out] RESID
105 *> \verbatim
106 *> RESID is REAL
107 *> If UPLO = 'L', norm(L*D*L' - A) / ( N * norm(A) * EPS )
108 *> If UPLO = 'U', norm(U*D*U' - A) / ( N * norm(A) * EPS )
109 *> \endverbatim
110 *
111 * Authors:
112 * ========
113 *
114 *> \author Univ. of Tennessee
115 *> \author Univ. of California Berkeley
116 *> \author Univ. of Colorado Denver
117 *> \author NAG Ltd.
118 *
119 *> \date December 2016
120 *
121 * @generated from LIN/dsyt01_aa.f, fortran d -> c, Thu Nov 17 13:01:50 2016
122 *
123 *> \ingroup complex_lin
124 *
125 * =====================================================================
126  SUBROUTINE csyt01_aa( UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C,
127  $ ldc, rwork, resid )
128 *
129 * -- LAPACK test routine (version 3.7.0) --
130 * -- LAPACK is a software package provided by Univ. of Tennessee, --
131 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * December 2016
133 *
134 * .. Scalar Arguments ..
135  CHARACTER UPLO
136  INTEGER LDA, LDAFAC, LDC, N
137  REAL RESID
138 * ..
139 * .. Array Arguments ..
140  INTEGER IPIV( * )
141  COMPLEX A( lda, * ), AFAC( ldafac, * ), C( ldc, * )
142  REAL RWORK( * )
143 * ..
144 *
145 * =====================================================================
146 *
147 * .. Parameters ..
148  REAL ZERO, ONE
149  parameter ( zero = 0.0d+0, one = 1.0d+0 )
150  COMPLEX CZERO, CONE
151  parameter ( czero = 0.0e+0, cone = 1.0e+0 )
152 * ..
153 * .. Local Scalars ..
154  INTEGER I, J
155  REAL ANORM, EPS
156 * ..
157 * .. External Functions ..
158  LOGICAL LSAME
159  REAL SLAMCH, CLANSY
160  EXTERNAL lsame, slamch, clansy
161 * ..
162 * .. External Subroutines ..
163  EXTERNAL claset, clavsy
164 * ..
165 * .. Intrinsic Functions ..
166  INTRINSIC dble
167 * ..
168 * .. Executable Statements ..
169 *
170 * Quick exit if N = 0.
171 *
172  IF( n.LE.0 ) THEN
173  resid = zero
174  RETURN
175  END IF
176 *
177 * Determine EPS and the norm of A.
178 *
179  eps = slamch( 'Epsilon' )
180  anorm = clansy( '1', uplo, n, a, lda, rwork )
181 *
182 * Initialize C to the tridiagonal matrix T.
183 *
184  CALL claset( 'Full', n, n, czero, czero, c, ldc )
185  CALL clacpy( 'F', 1, n, afac( 1, 1 ), ldafac+1, c( 1, 1 ), ldc+1 )
186  IF( n.GT.1 ) THEN
187  IF( lsame( uplo, 'U' ) ) THEN
188  CALL clacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 1, 2 ),
189  $ ldc+1 )
190  CALL clacpy( 'F', 1, n-1, afac( 1, 2 ), ldafac+1, c( 2, 1 ),
191  $ ldc+1 )
192  ELSE
193  CALL clacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 1, 2 ),
194  $ ldc+1 )
195  CALL clacpy( 'F', 1, n-1, afac( 2, 1 ), ldafac+1, c( 2, 1 ),
196  $ ldc+1 )
197  ENDIF
198 *
199 * Call CTRMM to form the product U' * D (or L * D ).
200 *
201  IF( lsame( uplo, 'U' ) ) THEN
202  CALL ctrmm( 'Left', uplo, 'Transpose', 'Unit', n-1, n,
203  $ cone, afac( 1, 2 ), ldafac, c( 2, 1 ), ldc )
204  ELSE
205  CALL ctrmm( 'Left', uplo, 'No transpose', 'Unit', n-1, n,
206  $ cone, afac( 2, 1 ), ldafac, c( 2, 1 ), ldc )
207  END IF
208 *
209 * Call CTRMM again to multiply by U (or L ).
210 *
211  IF( lsame( uplo, 'U' ) ) THEN
212  CALL ctrmm( 'Right', uplo, 'No transpose', 'Unit', n, n-1,
213  $ cone, afac( 1, 2 ), ldafac, c( 1, 2 ), ldc )
214  ELSE
215  CALL ctrmm( 'Right', uplo, 'Transpose', 'Unit', n, n-1,
216  $ cone, afac( 2, 1 ), ldafac, c( 1, 2 ), ldc )
217  END IF
218  ENDIF
219 *
220 * Apply symmetric pivots
221 *
222  DO j = n, 1, -1
223  i = ipiv( j )
224  IF( i.NE.j )
225  $ CALL cswap( n, c( j, 1 ), ldc, c( i, 1 ), ldc )
226  END DO
227  DO j = n, 1, -1
228  i = ipiv( j )
229  IF( i.NE.j )
230  $ CALL cswap( n, c( 1, j ), 1, c( 1, i ), 1 )
231  END DO
232 *
233 *
234 * Compute the difference C - A .
235 *
236  IF( lsame( uplo, 'U' ) ) THEN
237  DO j = 1, n
238  DO i = 1, j
239  c( i, j ) = c( i, j ) - a( i, j )
240  END DO
241  END DO
242  ELSE
243  DO j = 1, n
244  DO i = j, n
245  c( i, j ) = c( i, j ) - a( i, j )
246  END DO
247  END DO
248  END IF
249 *
250 * Compute norm( C - A ) / ( N * norm(A) * EPS )
251 *
252  resid = clansy( '1', uplo, n, c, ldc, rwork )
253 *
254  IF( anorm.LE.zero ) THEN
255  IF( resid.NE.zero )
256  $ resid = one / eps
257  ELSE
258  resid = ( ( resid / dble( n ) ) / anorm ) / eps
259  END IF
260 *
261  RETURN
262 *
263 * End of CSYT01
264 *
265  END
subroutine csyt01_aa(UPLO, N, A, LDA, AFAC, LDAFAC, IPIV, C, LDC, RWORK, RESID)
CSYT01
Definition: csyt01_aa.f:128
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: claset.f:108
subroutine clavsy(UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
CLAVSY
Definition: clavsy.f:155
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
subroutine ctrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
CTRMM
Definition: ctrmm.f:179
subroutine cswap(N, CX, INCX, CY, INCY)
CSWAP
Definition: cswap.f:52