aboutsummaryrefslogtreecommitdiff
path: root/math/ieee/chap1/weave1.f
blob: 9c83d0eae5823628e020e4de8ecc6c9a66b4e0d6 (plain) (blame)
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
361
362
363
364
365
366
367
368
369
370
371
c
c-----------------------------------------------------------------------
c subroutine: weave1
c   this subroutine implements the different pre-weave
c   modules of the wfta.  the working arrays are sr and si.
c   the routine checks to see which factors are present
c   in the transform length n = na*nb*nc*nd and executes
c   the pre-weave code for these factors.
c
c-----------------------------------------------------------------------
c
      subroutine weave1(sr,si)
      common na,nb,nc,nd,nd1,nd2,nd3,nd4
      dimension q(8),t(16)
      dimension sr(1),si(1)
      if(na.eq.1) go to 300
      if(na.ne.2) go to 800
c
c **********************************************************************
c
c     the following code implements the 2 point pre-weave module
c
c **********************************************************************
c
      nlup2=2*(nd2-nb)
      nlup23=2*nd2*(nd3-nc)
      nbase=1
      do 240 n4=1,nd
      do 230 n3=1,nc
      do 220 n2=1,nb
      nr1=nbase+1
      t0=sr(nbase)+sr(nr1)
      sr(nr1)=sr(nbase)-sr(nr1)
      sr(nbase)=t0
      t0=si(nbase)+si(nr1)
      si(nr1)=si(nbase)-si(nr1)
      si(nbase)=t0
220   nbase=nbase+2
230   nbase=nbase+nlup2
240   nbase=nbase+nlup23
800   if(na.ne.8) go to 1600
c
c **********************************************************************
c
c     the following code implements the 8 point pre-weave module
c
c **********************************************************************
c
      nlup2=8*(nd2-nb)
      nlup23=8*nd2*(nd3-nc)
      nbase=1
      do 840 n4=1,nd
      do 830 n3=1,nc
      do 820 n2=1,nb
      nr1=nbase+1
      nr2=nr1+1
      nr3=nr2+1
      nr4=nr3+1
      nr5=nr4+1
      nr6=nr5+1
      nr7=nr6+1
      t3=sr(nr3)+sr(nr7)
      t7=sr(nr3)-sr(nr7)
      t0=sr(nbase)+sr(nr4)
      sr(nr4)=sr(nbase)-sr(nr4)
      t1=sr(nr1)+sr(nr5)
      t5=sr(nr1)-sr(nr5)
      t2=sr(nr2)+sr(nr6)
      sr(nr6)=sr(nr2)-sr(nr6)
      sr(nbase)=t0+t2
      sr(nr2)=t0-t2
      sr(nr1)=t1+t3
      sr(nr3)=t1-t3
      sr(nr5)=t5+t7
      sr(nr7)=t5-t7
      t3=si(nr3)+si(nr7)
      t7=si(nr3)-si(nr7)
      t0=si(nbase)+si(nr4)
      si(nr4)=si(nbase)-si(nr4)
      t1=si(nr1)+si(nr5)
      t5=si(nr1)-si(nr5)
      t2=si(nr2)+si(nr6)
      si(nr6)=si(nr2)-si(nr6)
      si(nbase)=t0+t2
      si(nr2)=t0-t2
      si(nr1)=t1+t3
      si(nr3)=t1-t3
      si(nr5)=t5+t7
      si(nr7)=t5-t7
820   nbase=nbase+8
830   nbase=nbase+nlup2
840   nbase=nbase+nlup23
1600  if(na.ne.16) go to 300
c
c **********************************************************************
c
c     the following code implements the 16 point pre-weave module
c
c **********************************************************************
c
      nlup2=18*(nd2-nb)
      nlup23=18*nd2*(nd3-nc)
      nbase=1
      do 1640 n4=1,nd
      do 1630 n3=1,nc
      do 1620 n2=1,nb
      nr1=nbase+1
      nr2=nr1+1
      nr3=nr2+1
      nr4=nr3+1
      nr5=nr4+1
      nr6=nr5+1
      nr7=nr6+1
      nr8=nr7+1
      nr9=nr8+1
      nr10=nr9+1
      nr11=nr10+1
      nr12=nr11+1
      nr13=nr12+1
      nr14=nr13+1
      nr15=nr14+1
      nr16=nr15+1
      nr17=nr16+1
      jbase=nbase
      do 1645 j=1,8
      t(j)=sr(jbase)+sr(jbase+8)
      t(j+8)=sr(jbase)-sr(jbase+8)
      jbase=jbase+1
1645  continue
      do 1650 j=1,4
      q(j)=t(j)+t(j+4)
      q(j+4)=t(j)-t(j+4)
1650  continue
      sr(nbase)=q(1)+q(3)
      sr(nr2)=q(1)-q(3)
      sr(nr1)=q(2)+q(4)
      sr(nr3)=q(2)-q(4)
      sr(nr5)=q(6)+q(8)
      sr(nr7)=q(6)-q(8)
      sr(nr4)=q(5)
      sr(nr6)=q(7)
      sr(nr8)=t(9)
      sr(nr9)=t(10)+t(16)
      sr(nr15)=t(10)-t(16)
      sr(nr13)=t(14)+t(12)
      sr(nr11)=t(14)-t(12)
      sr(nr17)=sr(nr11)+sr(nr15)
      sr(nr16)=sr(nr9)+sr(nr13)
      sr(nr10)=t(11)+t(15)
      sr(nr14)=t(11)-t(15)
      sr(nr12)=t(13)
      jbase=nbase
      do 1745 j=1,8
      t(j)=si(jbase)+si(jbase+8)
      t(j+8)=si(jbase)-si(jbase+8)
      jbase=jbase+1
1745  continue
      do 1750 j=1,4
      q(j)=t(j)+t(j+4)
      q(j+4)=t(j)-t(j+4)
1750  continue
      si(nbase)=q(1)+q(3)
      si(nr2)=q(1)-q(3)
      si(nr1)=q(2)+q(4)
      si(nr3)=q(2)-q(4)
      si(nr5)=q(6)+q(8)
      si(nr7)=q(6)-q(8)
      si(nr4)=q(5)
      si(nr6)=q(7)
      si(nr8)=t(9)
      si(nr9)=t(10)+t(16)
      si(nr15)=t(10)-t(16)
      si(nr13)=t(14)+t(12)
      si(nr11)=t(14)-t(12)
      si(nr17)=si(nr11)+si(nr15)
      si(nr16)=si(nr9)+si(nr13)
      si(nr10)=t(11)+t(15)
      si(nr14)=t(11)-t(15)
      si(nr12)=t(13)
1620  nbase=nbase+18
1630  nbase=nbase+nlup2
1640  nbase=nbase+nlup23
300   if(nb.eq.1) go to 700
      if(nb.ne.3) go to 900
c
c **********************************************************************
c
c     the following code implements the 3 point pre-weave module
c
c **********************************************************************
c
      nlup2=2*nd1
      nlup23=3*nd1*(nd3-nc)
      nbase=1
      noff=nd1
      do 340 n4=1,nd
      do 330 n3=1,nc
      do 310 n2=1,nd1
      nr1=nbase+noff
      nr2=nr1+noff
      t1=sr(nr1)+sr(nr2)
      sr(nbase)=sr(nbase)+t1
      sr(nr2)=sr(nr1)-sr(nr2)
      sr(nr1)=t1
      t1=si(nr1)+si(nr2)
      si(nbase)=si(nbase)+t1
      si(nr2)=si(nr1)-si(nr2)
      si(nr1)=t1
310   nbase=nbase+1
330   nbase=nbase+nlup2
340   nbase=nbase+nlup23
900   if(nb.ne.9) go to 700
c
c **********************************************************************
c
c     the following code implements the 9 point pre-weave module
c
c **********************************************************************
c
      nlup2=10*nd1
      nlup23=11*nd1*(nd3-nc)
      nbase=1
      noff=nd1
      do 940 n4=1,nd
      do 930 n3=1,nc
      do 910 n2=1,nd1
      nr1=nbase+noff
      nr2=nr1+noff
      nr3=nr2+noff
      nr4=nr3+noff
      nr5=nr4+noff
      nr6=nr5+noff
      nr7=nr6+noff
      nr8=nr7+noff
      nr9=nr8+noff
      nr10=nr9+noff
      t3=sr(nr3)+sr(nr6)
      t6=sr(nr3)-sr(nr6)
      sr(nbase)=sr(nbase)+t3
      t7=sr(nr7)+sr(nr2)
      t2=sr(nr7)-sr(nr2)
      sr(nr2)=t6
      t1=sr(nr1)+sr(nr8)
      t8=sr(nr1)-sr(nr8)
      sr(nr1)=t3
      t4=sr(nr4)+sr(nr5)
      t5=sr(nr4)-sr(nr5)
      sr(nr3)=t1+t4+t7
      sr(nr4)=t1-t7
      sr(nr5)=t4-t1
      sr(nr6)=t7-t4
      sr(nr10)=t2+t5+t8
      sr(nr7)=t8-t2
      sr(nr8)=t5-t8
      sr(nr9)=t2-t5
      t3=si(nr3)+si(nr6)
      t6=si(nr3)-si(nr6)
      si(nbase)=si(nbase)+t3
      t7=si(nr7)+si(nr2)
      t2=si(nr7)-si(nr2)
      si(nr2)=t6
      t1=si(nr1)+si(nr8)
      t8=si(nr1)-si(nr8)
      si(nr1)=t3
      t4=si(nr4)+si(nr5)
      t5=si(nr4)-si(nr5)
      si(nr3)=t1+t4+t7
      si(nr4)=t1-t7
      si(nr5)=t4-t1
      si(nr6)=t7-t4
      si(nr10)=t2+t5+t8
      si(nr7)=t8-t2
      si(nr8)=t5-t8
      si(nr9)=t2-t5
910   nbase=nbase+1
930   nbase=nbase+nlup2
940   nbase=nbase+nlup23
700   if(nc.ne.7) go to 500
c
c **********************************************************************
c
c     the following code implements the 7 point pre-weave module
c
c **********************************************************************
c
      noff=nd1*nd2
      nbase=1
      nlup2=8*noff
      do 740 n4=1,nd
      do 710 n1=1,noff
      nr1=nbase+noff
      nr2=nr1+noff
      nr3=nr2+noff
      nr4=nr3+noff
      nr5=nr4+noff
      nr6=nr5+noff
      nr7=nr6+noff
      nr8=nr7+noff
      t1=sr(nr1)+sr(nr6)
      t6=sr(nr1)-sr(nr6)
      t4=sr(nr4)+sr(nr3)
      t3=sr(nr4)-sr(nr3)
      t2=sr(nr2)+sr(nr5)
      t5=sr(nr2)-sr(nr5)
      sr(nr5)=t6-t3
      sr(nr2)=t5+t3+t6
      sr(nr6)=t5-t6
      sr(nr8)=t3-t5
      sr(nr3)=t2-t1
      sr(nr4)=t1-t4
      sr(nr7)=t4-t2
      t1=t1+t4+t2
      sr(nbase)=sr(nbase)+t1
      sr(nr1)=t1
      t1=si(nr1)+si(nr6)
      t6=si(nr1)-si(nr6)
      t4=si(nr4)+si(nr3)
      t3=si(nr4)-si(nr3)
      t2=si(nr2)+si(nr5)
      t5=si(nr2)-si(nr5)
      si(nr5)=t6-t3
      si(nr2)=t5+t3+t6
      si(nr6)=t5-t6
      si(nr8)=t3-t5
      si(nr3)=t2-t1
      si(nr4)=t1-t4
      si(nr7)=t4-t2
      t1=t1+t4+t2
      si(nbase)=si(nbase)+t1
      si(nr1)=t1
710   nbase=nbase+1
740   nbase=nbase+nlup2
500   if(nd.ne.5) return
c
c **********************************************************************
c
c     the following code implements the 5 point pre-weave module
c
c **********************************************************************
c
      noff=nd1*nd2*nd3
      nbase=1
      do 510 n1=1,noff
      nr1=nbase+noff
      nr2=nr1+noff
      nr3=nr2+noff
      nr4=nr3+noff
      nr5=nr4+noff
      t4=sr(nr1)-sr(nr4)
      t1=sr(nr1)+sr(nr4)
      t3=sr(nr3)+sr(nr2)
      t2=sr(nr3)-sr(nr2)
      sr(nr3)=t1-t3
      sr(nr1)=t1+t3
      sr(nbase)=sr(nbase)+sr(nr1)
      sr(nr5)=t2+t4
      sr(nr2)=t4
      sr(nr4)=t2
      t4=si(nr1)-si(nr4)
      t1=si(nr1)+si(nr4)
      t3=si(nr3)+si(nr2)
      t2=si(nr3)-si(nr2)
      si(nr3)=t1-t3
      si(nr1)=t1+t3
      si(nbase)=si(nbase)+si(nr1)
      si(nr5)=t2+t4
      si(nr2)=t4
      si(nr4)=t2
510   nbase=nbase+1
      return
      end