LAPACK  3.10.1
LAPACK: Linear Algebra PACKage
sget54.f
Go to the documentation of this file.
1 *> \brief \b SGET54
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 SGET54( N, A, LDA, B, LDB, S, LDS, T, LDT, U, LDU, V,
12 * LDV, WORK, RESULT )
13 *
14 * .. Scalar Arguments ..
15 * INTEGER LDA, LDB, LDS, LDT, LDU, LDV, N
16 * REAL RESULT
17 * ..
18 * .. Array Arguments ..
19 * REAL A( LDA, * ), B( LDB, * ), S( LDS, * ),
20 * $ T( LDT, * ), U( LDU, * ), V( LDV, * ),
21 * $ WORK( * )
22 * ..
23 *
24 *
25 *> \par Purpose:
26 * =============
27 *>
28 *> \verbatim
29 *>
30 *> SGET54 checks a generalized decomposition of the form
31 *>
32 *> A = U*S*V' and B = U*T* V'
33 *>
34 *> where ' means transpose and U and V are orthogonal.
35 *>
36 *> Specifically,
37 *>
38 *> RESULT = ||( A - U*S*V', B - U*T*V' )|| / (||( A, B )||*n*ulp )
39 *> \endverbatim
40 *
41 * Arguments:
42 * ==========
43 *
44 *> \param[in] N
45 *> \verbatim
46 *> N is INTEGER
47 *> The size of the matrix. If it is zero, SGET54 does nothing.
48 *> It must be at least zero.
49 *> \endverbatim
50 *>
51 *> \param[in] A
52 *> \verbatim
53 *> A is REAL array, dimension (LDA, N)
54 *> The original (unfactored) matrix A.
55 *> \endverbatim
56 *>
57 *> \param[in] LDA
58 *> \verbatim
59 *> LDA is INTEGER
60 *> The leading dimension of A. It must be at least 1
61 *> and at least N.
62 *> \endverbatim
63 *>
64 *> \param[in] B
65 *> \verbatim
66 *> B is REAL array, dimension (LDB, N)
67 *> The original (unfactored) matrix B.
68 *> \endverbatim
69 *>
70 *> \param[in] LDB
71 *> \verbatim
72 *> LDB is INTEGER
73 *> The leading dimension of B. It must be at least 1
74 *> and at least N.
75 *> \endverbatim
76 *>
77 *> \param[in] S
78 *> \verbatim
79 *> S is REAL array, dimension (LDS, N)
80 *> The factored matrix S.
81 *> \endverbatim
82 *>
83 *> \param[in] LDS
84 *> \verbatim
85 *> LDS is INTEGER
86 *> The leading dimension of S. It must be at least 1
87 *> and at least N.
88 *> \endverbatim
89 *>
90 *> \param[in] T
91 *> \verbatim
92 *> T is REAL array, dimension (LDT, N)
93 *> The factored matrix T.
94 *> \endverbatim
95 *>
96 *> \param[in] LDT
97 *> \verbatim
98 *> LDT is INTEGER
99 *> The leading dimension of T. It must be at least 1
100 *> and at least N.
101 *> \endverbatim
102 *>
103 *> \param[in] U
104 *> \verbatim
105 *> U is REAL array, dimension (LDU, N)
106 *> The orthogonal matrix on the left-hand side in the
107 *> decomposition.
108 *> \endverbatim
109 *>
110 *> \param[in] LDU
111 *> \verbatim
112 *> LDU is INTEGER
113 *> The leading dimension of U. LDU must be at least N and
114 *> at least 1.
115 *> \endverbatim
116 *>
117 *> \param[in] V
118 *> \verbatim
119 *> V is REAL array, dimension (LDV, N)
120 *> The orthogonal matrix on the left-hand side in the
121 *> decomposition.
122 *> \endverbatim
123 *>
124 *> \param[in] LDV
125 *> \verbatim
126 *> LDV is INTEGER
127 *> The leading dimension of V. LDV must be at least N and
128 *> at least 1.
129 *> \endverbatim
130 *>
131 *> \param[out] WORK
132 *> \verbatim
133 *> WORK is REAL array, dimension (3*N**2)
134 *> \endverbatim
135 *>
136 *> \param[out] RESULT
137 *> \verbatim
138 *> RESULT is REAL
139 *> The value RESULT, It is currently limited to 1/ulp, to
140 *> avoid overflow. Errors are flagged by RESULT=10/ulp.
141 *> \endverbatim
142 *
143 * Authors:
144 * ========
145 *
146 *> \author Univ. of Tennessee
147 *> \author Univ. of California Berkeley
148 *> \author Univ. of Colorado Denver
149 *> \author NAG Ltd.
150 *
151 *> \ingroup single_eig
152 *
153 * =====================================================================
154  SUBROUTINE sget54( N, A, LDA, B, LDB, S, LDS, T, LDT, U, LDU, V,
155  $ LDV, WORK, RESULT )
156 *
157 * -- LAPACK test routine --
158 * -- LAPACK is a software package provided by Univ. of Tennessee, --
159 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
160 *
161 * .. Scalar Arguments ..
162  INTEGER LDA, LDB, LDS, LDT, LDU, LDV, N
163  REAL RESULT
164 * ..
165 * .. Array Arguments ..
166  REAL A( LDA, * ), B( LDB, * ), S( LDS, * ),
167  $ t( ldt, * ), u( ldu, * ), v( ldv, * ),
168  $ work( * )
169 * ..
170 *
171 * =====================================================================
172 *
173 * .. Parameters ..
174  REAL ZERO, ONE
175  parameter( zero = 0.0e+0, one = 1.0e+0 )
176 * ..
177 * .. Local Scalars ..
178  REAL ABNORM, ULP, UNFL, WNORM
179 * ..
180 * .. Local Arrays ..
181  REAL DUM( 1 )
182 * ..
183 * .. External Functions ..
184  REAL SLAMCH, SLANGE
185  EXTERNAL slamch, slange
186 * ..
187 * .. External Subroutines ..
188  EXTERNAL sgemm, slacpy
189 * ..
190 * .. Intrinsic Functions ..
191  INTRINSIC max, min, real
192 * ..
193 * .. Executable Statements ..
194 *
195  result = zero
196  IF( n.LE.0 )
197  $ RETURN
198 *
199 * Constants
200 *
201  unfl = slamch( 'Safe minimum' )
202  ulp = slamch( 'Epsilon' )*slamch( 'Base' )
203 *
204 * compute the norm of (A,B)
205 *
206  CALL slacpy( 'Full', n, n, a, lda, work, n )
207  CALL slacpy( 'Full', n, n, b, ldb, work( n*n+1 ), n )
208  abnorm = max( slange( '1', n, 2*n, work, n, dum ), unfl )
209 *
210 * Compute W1 = A - U*S*V', and put in the array WORK(1:N*N)
211 *
212  CALL slacpy( ' ', n, n, a, lda, work, n )
213  CALL sgemm( 'N', 'N', n, n, n, one, u, ldu, s, lds, zero,
214  $ work( n*n+1 ), n )
215 *
216  CALL sgemm( 'N', 'C', n, n, n, -one, work( n*n+1 ), n, v, ldv,
217  $ one, work, n )
218 *
219 * Compute W2 = B - U*T*V', and put in the workarray W(N*N+1:2*N*N)
220 *
221  CALL slacpy( ' ', n, n, b, ldb, work( n*n+1 ), n )
222  CALL sgemm( 'N', 'N', n, n, n, one, u, ldu, t, ldt, zero,
223  $ work( 2*n*n+1 ), n )
224 *
225  CALL sgemm( 'N', 'C', n, n, n, -one, work( 2*n*n+1 ), n, v, ldv,
226  $ one, work( n*n+1 ), n )
227 *
228 * Compute norm(W)/ ( ulp*norm((A,B)) )
229 *
230  wnorm = slange( '1', n, 2*n, work, n, dum )
231 *
232  IF( abnorm.GT.wnorm ) THEN
233  result = ( wnorm / abnorm ) / ( 2*n*ulp )
234  ELSE
235  IF( abnorm.LT.one ) THEN
236  result = ( min( wnorm, 2*n*abnorm ) / abnorm ) / ( 2*n*ulp )
237  ELSE
238  result = min( wnorm / abnorm, real( 2*n ) ) / ( 2*n*ulp )
239  END IF
240  END IF
241 *
242  RETURN
243 *
244 * End of SGET54
245 *
246  END
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.f:103
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:187
subroutine sget54(N, A, LDA, B, LDB, S, LDS, T, LDT, U, LDU, V, LDV, WORK, RESULT)
SGET54
Definition: sget54.f:156