1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
*> \brief \b DGET33
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE DGET33( RMAX, LMAX, NINFO, KNT )
*
* .. Scalar Arguments ..
* INTEGER KNT, LMAX, NINFO
* DOUBLE PRECISION RMAX
* ..
*
*
*> \par Purpose:
* =============
*>
*> \verbatim
*>
*> DGET33 tests DLANV2, a routine for putting 2 by 2 blocks into
*> standard form. In other words, it computes a two by two rotation
*> [[C,S];[-S,C]] where in
*>
*> [ C S ][T(1,1) T(1,2)][ C -S ] = [ T11 T12 ]
*> [-S C ][T(2,1) T(2,2)][ S C ] [ T21 T22 ]
*>
*> either
*> 1) T21=0 (real eigenvalues), or
*> 2) T11=T22 and T21*T12<0 (complex conjugate eigenvalues).
*> We also verify that the residual is small.
*> \endverbatim
*
* Arguments:
* ==========
*
*> \param[out] RMAX
*> \verbatim
*> RMAX is DOUBLE PRECISION
*> Value of the largest test ratio.
*> \endverbatim
*>
*> \param[out] LMAX
*> \verbatim
*> LMAX is INTEGER
*> Example number where largest test ratio achieved.
*> \endverbatim
*>
*> \param[out] NINFO
*> \verbatim
*> NINFO is INTEGER
*> Number of examples returned with INFO .NE. 0.
*> \endverbatim
*>
*> \param[out] KNT
*> \verbatim
*> KNT is INTEGER
*> Total number of examples tested.
*> \endverbatim
*
* Authors:
* ========
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \date November 2011
*
*> \ingroup double_eig
*
* =====================================================================
SUBROUTINE DGET33( RMAX, LMAX, NINFO, KNT )
*
* -- LAPACK test routine (version 3.4.0) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER KNT, LMAX, NINFO
DOUBLE PRECISION RMAX
* ..
*
* =====================================================================
*
* .. Parameters ..
DOUBLE PRECISION ZERO, ONE
PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
DOUBLE PRECISION TWO, FOUR
PARAMETER ( TWO = 2.0D0, FOUR = 4.0D0 )
* ..
* .. Local Scalars ..
INTEGER I1, I2, I3, I4, IM1, IM2, IM3, IM4, J1, J2, J3
DOUBLE PRECISION BIGNUM, CS, EPS, RES, SMLNUM, SN, SUM, TNRM,
$ WI1, WI2, WR1, WR2
* ..
* .. Local Arrays ..
DOUBLE PRECISION Q( 2, 2 ), T( 2, 2 ), T1( 2, 2 ), T2( 2, 2 ),
$ VAL( 4 ), VM( 3 )
* ..
* .. External Functions ..
DOUBLE PRECISION DLAMCH
EXTERNAL DLAMCH
* ..
* .. External Subroutines ..
EXTERNAL DLABAD, DLANV2
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MAX, SIGN
* ..
* .. Executable Statements ..
*
* Get machine parameters
*
EPS = DLAMCH( 'P' )
SMLNUM = DLAMCH( 'S' ) / EPS
BIGNUM = ONE / SMLNUM
CALL DLABAD( SMLNUM, BIGNUM )
*
* Set up test case parameters
*
VAL( 1 ) = ONE
VAL( 2 ) = ONE + TWO*EPS
VAL( 3 ) = TWO
VAL( 4 ) = TWO - FOUR*EPS
VM( 1 ) = SMLNUM
VM( 2 ) = ONE
VM( 3 ) = BIGNUM
*
KNT = 0
NINFO = 0
LMAX = 0
RMAX = ZERO
*
* Begin test loop
*
DO 150 I1 = 1, 4
DO 140 I2 = 1, 4
DO 130 I3 = 1, 4
DO 120 I4 = 1, 4
DO 110 IM1 = 1, 3
DO 100 IM2 = 1, 3
DO 90 IM3 = 1, 3
DO 80 IM4 = 1, 3
T( 1, 1 ) = VAL( I1 )*VM( IM1 )
T( 1, 2 ) = VAL( I2 )*VM( IM2 )
T( 2, 1 ) = -VAL( I3 )*VM( IM3 )
T( 2, 2 ) = VAL( I4 )*VM( IM4 )
TNRM = MAX( ABS( T( 1, 1 ) ),
$ ABS( T( 1, 2 ) ), ABS( T( 2, 1 ) ),
$ ABS( T( 2, 2 ) ) )
T1( 1, 1 ) = T( 1, 1 )
T1( 1, 2 ) = T( 1, 2 )
T1( 2, 1 ) = T( 2, 1 )
T1( 2, 2 ) = T( 2, 2 )
Q( 1, 1 ) = ONE
Q( 1, 2 ) = ZERO
Q( 2, 1 ) = ZERO
Q( 2, 2 ) = ONE
*
CALL DLANV2( T( 1, 1 ), T( 1, 2 ),
$ T( 2, 1 ), T( 2, 2 ), WR1,
$ WI1, WR2, WI2, CS, SN )
DO 10 J1 = 1, 2
RES = Q( J1, 1 )*CS + Q( J1, 2 )*SN
Q( J1, 2 ) = -Q( J1, 1 )*SN +
$ Q( J1, 2 )*CS
Q( J1, 1 ) = RES
10 CONTINUE
*
RES = ZERO
RES = RES + ABS( Q( 1, 1 )**2+
$ Q( 1, 2 )**2-ONE ) / EPS
RES = RES + ABS( Q( 2, 2 )**2+
$ Q( 2, 1 )**2-ONE ) / EPS
RES = RES + ABS( Q( 1, 1 )*Q( 2, 1 )+
$ Q( 1, 2 )*Q( 2, 2 ) ) / EPS
DO 40 J1 = 1, 2
DO 30 J2 = 1, 2
T2( J1, J2 ) = ZERO
DO 20 J3 = 1, 2
T2( J1, J2 ) = T2( J1, J2 ) +
$ T1( J1, J3 )*
$ Q( J3, J2 )
20 CONTINUE
30 CONTINUE
40 CONTINUE
DO 70 J1 = 1, 2
DO 60 J2 = 1, 2
SUM = T( J1, J2 )
DO 50 J3 = 1, 2
SUM = SUM - Q( J3, J1 )*
$ T2( J3, J2 )
50 CONTINUE
RES = RES + ABS( SUM ) / EPS / TNRM
60 CONTINUE
70 CONTINUE
IF( T( 2, 1 ).NE.ZERO .AND.
$ ( T( 1, 1 ).NE.T( 2,
$ 2 ) .OR. SIGN( ONE, T( 1,
$ 2 ) )*SIGN( ONE, T( 2,
$ 1 ) ).GT.ZERO ) )RES = RES + ONE / EPS
KNT = KNT + 1
IF( RES.GT.RMAX ) THEN
LMAX = KNT
RMAX = RES
END IF
80 CONTINUE
90 CONTINUE
100 CONTINUE
110 CONTINUE
120 CONTINUE
130 CONTINUE
140 CONTINUE
150 CONTINUE
*
RETURN
*
* End of DGET33
*
END
|