File: sys.vops.md

package info (click to toggle)
iraf 2.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,000 kB
  • sloc: ansic: 115,890; fortran: 74,576; lisp: 18,888; yacc: 5,642; sh: 961; lex: 596; makefile: 509; asm: 159; csh: 54; xml: 33; sed: 4
file content (60 lines) | stat: -rw-r--r-- 1,618 bytes parent folder | download | duplicates (2)
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
# Test of sys/vops routines

## FFT842: fast fourier transform for complex input


This program replaces the vector z=x+iy by its finite discrete, complex
fourier transform if `in=0`. The inverse transform is calculated for `in=1`.

File: `test_fft842.x`
```
task test_fft842 = t_fft842

procedure eval_fft842(x, y, ndim)
int ndim
real x[ndim], y[ndim]
int j
int ier
begin
    call printf("FFT input  ")
    do j = 1, ndim {
        call printf(" (%6.3f;%4.3f)")
        call pargr(x[j])
        call pargr(y[j])
    }
    call fft842(0, ndim, x, y, ier)
    call printf("\nFFT output ")
    do j = 1, ndim {
        call printf(" (%6.3f;%4.3f)")
        call pargr(x[j])
        call pargr(y[j])
    }
    call fft842(1, ndim, x, y, ier)
    call printf("\nInverse    ")
    do j = 1, ndim {
        call printf(" (%6.3f;%4.3f)")
        call pargr(x[j])
        call pargr(y[j])
    }
    call printf("\n")
end

procedure t_fft842 ()
real x[8], y[8]
data x /1.0, 2.0, 1.0, -1.0, 1.5, 1.0, 0.5, 1.0/
data y /0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/
begin
    call eval_fft842(x, y, 8)
end
```

Test options: `decimals=4`
```
cl> softools
cl> xc -x test_fft842.x
cl> task $test_fft842 = test_fft842.e
cl> test_fft842
FFT input   ( 1.000;0.00) ( 2.000;0.00) ( 1.000;0.00) (-1.000;0.00) ( 1.500;0.00) ( 1.000;0.00) ( 0.500;0.00) ( 1.000;0.00)
FFT output  ( 7.0000;0.0000) ( 1.6210;0.2100) ( 1.0000;-3.0000) (-2.6210;1.2100) ( 1.0000;0.0000) (-2.6210;-1.2000) ( 1.0000;3.0000) ( 1.6210;0.2000)
Inverse     ( 1.000;0.00) ( 2.000;0.00) ( 1.000;0.00) (-1.000;0.00) ( 1.500;0.00) ( 1.000;0.00) ( 0.500;0.00) ( 1.000;0.00)
```