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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input ndftip.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1996.
@
<<*>>=
<<license>>
-- Note that the conversions of results from DoubleFloat to Float
-- will become unnecessary if outputGeneral is extended to apply to
-- DoubleFloat quantities. Those results not converted will, of
-- course, then be displayed to 6 s.f.
outputGeneral 6
seqA := [0.34907,0.54890,0.74776,0.94459,1.1385,1.3285,1.5137];
seqB := [0.34907 - 0.37168*%i, _
0.54890 - 0.35669*%i, _
0.74776 - 0.31175*%i, _
0.94459 - 0.23702*%i, _
1.13850 - 0.13274*%i, _
1.32850 + 0.00074*%i, _
1.51370 + 0.16298*%i];
hseqC : PackedHermitianSequence DoubleFloat
hseqC := packHS [0.34907, _
0.54890 + %i*1.51370, _
0.74776 + %i*1.32850, _
0.94459 + %i*1.13850, _
0.94459 - %i*1.13850, _
0.74776 - %i*1.32850, _
0.54890 - %i*1.51370];
seqsD : List Vector DoubleFloat;
seqsD := [vector [0.3854, 0.6772, 0.1138, 0.6751, 0.6362, 0.1424], _
vector [0.5417, 0.2983, 0.1181, 0.7255, 0.8638, 0.8723], _
vector [0.9172, 0.0644, 0.6037, 0.6430, 0.0428, 0.4815]];
seqsE : List PackedHermitianSequence DoubleFloat;
seqsE := [pHS [0.3854, 0.6772, 0.1138, 0.6751, 0.6362, 0.1424], _
pHS [0.5417, 0.2983, 0.1181, 0.7255, 0.8638, 0.8723], _
pHS [0.9172, 0.0644, 0.6037, 0.6430, 0.0428, 0.4815]];
seqsF : List Vector Complex DoubleFloat
seqsF := [vector [0.3854 + 0.5417*%i, 0.6772 + 0.2983*%i, _
0.1138 + 0.1181*%i, 0.6751 + 0.7255*%i, _
0.6362 + 0.8638*%i, 0.1424 + 0.8723*%i], _
vector [0.9172 + 0.9089*%i, 0.0644 + 0.3118*%i, _
0.6037 + 0.3465*%i, 0.6430 + 0.6198*%i, _
0.0428 + 0.2668*%i, 0.4815 + 0.1614*%i], _
vector [0.1156 + 0.6214*%i, 0.0685 + 0.8681*%i, _
0.2060 + 0.7060*%i, 0.8630 + 0.8652*%i, _
0.6967 + 0.9190*%i, 0.2792 + 0.3355*%i]];
-- test 1
dftA := nagDFT seqA;
dftA :: Vector Complex Float :: Matrix Complex Float
-- Matrix to force display as a column,
-- Float to allow outputGeneral to work.
-- + 2.48361 +
-- | |
-- |- 0.265985 + 0.530898 %i |
-- | |
-- |- 0.257682 + 0.202979 %i |
-- | |
-- |- 0.256363 + 0.0580623 %i|
-- | |
-- |- 0.256363 - 0.0580623 %i|
-- | |
-- |- 0.257682 - 0.202979 %i |
-- | |
-- +- 0.265985 - 0.530898 %i +
-- test 2
nagInverseDFT dftA :: Vector Float
-- [0.34907,0.5489,0.74776,0.94459,1.1385,1.3285,1.5137]
-- test 3
dftB := nagDFT seqB;
dftB :: Vector Complex Float :: Matrix Complex Float
-- + 2.48361 - 0.471004 %i +
-- | |
-- | - 0.5518 + 0.496841 %i |
-- | |
-- |- 0.367113 + 0.0975621 %i|
-- | |
-- |- 0.287669 - 0.0586476 %i|
-- | |
-- |- 0.225057 - 0.174772 %i |
-- | |
-- |- 0.148251 - 0.308396 %i |
-- | |
-- + 0.0198297 - 0.564956 %i +
-- test 4
(nagInverseDFT dftB) :: Vector Complex Float :: Matrix Complex Float
-- +0.34907 - 0.37168 %i+
-- | |
-- |0.5489 - 0.35669 %i |
-- | |
-- |0.74776 - 0.31175 %i|
-- | |
-- |0.94459 - 0.23702 %i|
-- | |
-- |1.1385 - 0.13274 %i |
-- | |
-- |1.3285 + 0.00074 %i |
-- | |
-- +1.5137 + 0.16298 %i +
-- test 5
hdftA := nagHermitianDFT seqA;
(expand hdftA) :: Vector Complex Float :: Matrix Complex Float
-- + 2.48361 +
-- | |
-- |- 0.265985 + 0.530898 %i |
-- | |
-- |- 0.257682 + 0.202979 %i |
-- | |
-- |- 0.256363 + 0.0580623 %i|
-- | |
-- |- 0.256363 - 0.0580623 %i|
-- | |
-- |- 0.257682 - 0.202979 %i |
-- | |
-- +- 0.265985 - 0.530898 %i +
-- test 6
(nagInverseDFT hdftA) :: Vector Float
-- [0.34907,0.5489,0.74776,0.94459,1.1385,1.3285,1.5137]
-- test 7
dftC := nagDFT hseqC;
dftC :: Vector Float
-- [1.82616,1.86862,- 0.017503,0.502001,- 0.598725,- 0.0314404,- 2.62557]
-- test 8
(nagInverseDFT dftC) :: Vector Complex Float
-- [0.34907, 0.5489 + 1.5137 %i, 0.74776 + 1.3285 %i, 0.94459 + 1.1385 %i,
-- 0.94459 - 1.1385 %i, 0.74776 - 1.3285 %i, 0.5489 - 1.5137 %i]
-- test 9
nagHermitianInverseDFT dftC
-- [0.34907000000000005, 0.54889999999999983, 0.74775999999999987,
-- 0.94459000000000004, 1.1385000000000003, 1.3284999999999998,
-- 1.5136999999999998]
-- test 10:
dftsD := nagDFT seqsD;
dftsD :: List Vector Complex Float
-- [
-- [1.07373, - 0.104062 - 0.00438406 %i, 0.112554 - 0.373777 %i, - 0.146684,
-- 0.112554 + 0.373777 %i, - 0.104062 + 0.00438406 %i]
-- ,
-- [1.39609, - 0.0365178 + 0.466584 %i, 0.077955 - 0.0607051 %i, - 0.152072,
-- 0.077955 + 0.0607051 %i, - 0.0365178 - 0.466584 %i]
-- ,
-- [1.12374, 0.0914068 - 0.050841 %i, 0.393551 + 0.345775 %i, 0.153011,
-- 0.393551 - 0.345775 %i, 0.0914068 + 0.050841 %i]
-- ]
-- test 11:
invdftsD := nagInverseDFT dftsD ;
invdftsD :: List Vector Complex Float
-- [[0.3854,0.6772,0.1138,0.6751,0.6362,0.1424],
-- [0.5417,0.2983,0.1181,0.7255,0.8638,0.8723],
-- [0.9172,0.0644,0.6037,0.643,0.0428,0.4815]]
-- test 12:
dftsE := nagDFT seqsE;
dftsE :: List Vector Float
-- [[1.0788,0.662291,- 0.239146,- 0.578284,0.459192,- 0.438816],
-- [0.857321,1.22614,0.353348,- 0.222169,0.341327,- 1.22908],
-- [1.18245,0.262509,0.674406,0.552278,0.0539906,- 0.478963]]
-- test 13:
invdftsE := nagInverseDFT dftsE;
invdftsE :: List Vector Complex Float
-- [
-- [0.3854, 0.6772 + 0.1424 %i, 0.1138 + 0.6362 %i, 0.6751,
-- 0.1138 - 0.6362 %i, 0.6772 - 0.1424 %i]
-- ,
-- [0.5417, 0.2983 + 0.8723 %i, 0.1181 + 0.8638 %i, 0.7255,
-- 0.1181 - 0.8638 %i, 0.2983 - 0.8723 %i]
-- ,
-- [0.9172, 0.0644 + 0.4815 %i, 0.6037 + 0.0428 %i, 0.643,
-- 0.6037 - 0.0428 %i, 0.0644 - 0.4815 %i]
-- ]
-- test 14:
hdftsD := nagHermitianDFT seqsD;
map(expand,hdftsD) :: List Vector Complex Float
-- [
-- [1.07373, - 0.104062 - 0.00438406 %i, 0.112554 - 0.373777 %i, - 0.146684,
-- 0.112554 + 0.373777 %i, - 0.104062 + 0.00438406 %i]
-- ,
-- [1.39609, - 0.0365178 + 0.466584 %i, 0.077955 - 0.0607051 %i, - 0.152072,
-- 0.077955 + 0.0607051 %i, - 0.0365178 - 0.466584 %i]
-- ,
-- [1.12374, 0.0914068 - 0.050841 %i, 0.393551 + 0.345775 %i, 0.153011,
-- 0.393551 - 0.345775 %i, 0.0914068 + 0.050841 %i]
-- ]
-- test 15:
(nagInverseDFT hdftsD) :: List Vector Float
-- [[0.3854,0.6772,0.1138,0.6751,0.6362,0.1424],
-- [0.5417,0.2983,0.1181,0.7255,0.8638,0.8723],
-- [0.9172,0.0644,0.6037,0.643,0.0428,0.4815]]
-- test 16:
dftsF := nagDFT seqsF;
dftsF :: List Vector Complex Float
-- [
-- [1.07373 + 1.39609 %i, - 0.570647 - 0.0409019 %i, 0.173259 - 0.295822 %i,
-- - 0.146684 - 0.152072 %i, 0.0518489 + 0.451732 %i,
-- 0.362522 - 0.0321337 %i]
-- ,
-- [1.12374 + 1.06765 %i, 0.172759 + 0.0385858 %i, 0.418548 + 0.748083 %i,
-- 0.153011 + 0.17522 %i, 0.368555 + 0.0565331 %i, 0.0100542 + 0.140268 %i]
-- ,
-- [0.909985 + 1.76167 %i, - 0.305418 + 0.0624335 %i,
-- 0.407884 - 0.0694786 %i, - 0.078547 + 0.0725049 %i,
-- - 0.119334 + 0.128511 %i, - 0.531409 - 0.433531 %i]
-- ]
-- test 17:
invdftsF := nagInverseDFT dftsF ;
invdftsF :: List Vector Complex Float
-- [
-- [0.3854 + 0.5417 %i, 0.6772 + 0.2983 %i, 0.1138 + 0.1181 %i,
-- 0.6751 + 0.7255 %i, 0.6362 + 0.8638 %i, 0.1424 + 0.8723 %i]
-- ,
-- [0.9172 + 0.9089 %i, 0.0644 + 0.3118 %i, 0.6037 + 0.3465 %i,
-- 0.643 + 0.6198 %i, 0.0428 + 0.2668 %i, 0.4815 + 0.1614 %i]
-- ,
-- [0.1156 + 0.6214 %i, 0.0685 + 0.8681 %i, 0.206 + 0.706 %i,
-- 0.863 + 0.8652 %i, 0.6967 + 0.919 %i, 0.2792 + 0.3355 %i]
-- ]
-- test 18:
nagHermitianInverseDFT dftsE
-- [
-- [0.38540000000000013, 0.67720000000000025, 0.11380000000000001,
-- 0.67510000000000014, 0.63620000000000021, 0.14240000000000003]
-- ,
-- [0.54170000000000018, 0.29830000000000012, 0.1181, 0.72550000000000014,
-- 0.86380000000000023, 0.87230000000000019]
-- ,
-- [0.91720000000000035, 0.064399999999999999, 0.60370000000000024,
-- 0.64300000000000013, 0.042799999999999991, 0.48150000000000015]
-- ]
-- error tests:
-- test 19:
nagDFT [vector [0.3854 + 0.5417*%i, 0.6772 + 0.2983*%i, _
0.1138 + 0.1181*%i, 0.6751 + 0.7255*%i, _
0.6362 + 0.8638*%i, 0.1424 + 0.8723*%i], _
vector [0.1156 + 0.6214*%i, 0.0685 + 0.8681*%i, _
0.6967 + 0.9190*%i, 0.2792 + 0.3355*%i]]
-- Error signalled from user code:
-- The data sequences in nagDFT must all have the same length. The
-- length of sequence 1 is 6 that of sequence 2 is 4.
-- test 20:
nagHermitianDFT [vector [0.3854, 0.6751, 0.6362, 0.1424], _
vector [0.5417, 0.7255, 0.8638, 0.8723], _
vector [0.9172, 0.0428, 0.4815]]
-- Error signalled from user code:
-- The data sequences in nagHermitianDFT must all have the same
-- length. The length of sequence 1 is 4 that of sequence 3 is 3.
-- test 21:
badSeqs : List PackedHermitianSequence DoubleFloat
badSeqs := [pHS [0.3854, 0.1138, 0.6751, 0.6362, 0.1424], _
pHS [0.5417, 0.2983, 0.1181, 0.7255, 0.8638, 0.8723], _
pHS [0.9172, 0.0644, 0.6037, 0.6430, 0.0428, 0.4815]];
nagDFT badSeqs
-- Error signalled from user code:
-- The data sequences in nagDFT must all have the same length. The
-- length of sequence 1 is 5 that of sequence 2 is 6.
outputGeneral()
output "End of tests"
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}
|