1 ;; functions that are somehow related to the fouriertransform
5 (def-generator (fftshift (rank type
))
7 (declare ((simple-array ,long-type
,rank
) in
)
8 (values (simple-array ,long-type
,rank
) &optional
))
9 (let ((out (make-array (array-dimensions in
)
10 :element-type
',long-type
)))
12 (1 `(destructuring-bind (x)
14 (let ((xx (floor x
2)))
16 (let ((ii (mod (+ i xx
) x
)))
19 (2 `(destructuring-bind (y x
)
21 (let ((xx (floor x
2))
23 (do-region ((j i
) (y x
))
24 (let ((ii (mod (+ i xx
) x
))
25 (jj (mod (+ j yy
) y
)))
28 (3 `(destructuring-bind (z y x
)
30 (let ((xx (floor x
2))
33 (do-region ((k j i
) (z y x
))
34 (let ((ii (mod (+ i xx
) x
))
36 (kk (mod (+ k zz
) z
)))
37 (setf (aref out k j i
)
38 (aref in kk jj ii
))))))))
42 (def-fftshift-rk-type 3 sf
)
44 (defmacro def-fftshift-functions
(ranks types
)
46 (loop for rank in ranks do
47 (loop for type in types do
48 (push `(def-fftshift-rank-type ,rank
,type
)
52 (def-fftshift-functions (1 2 3) (cdf csf
))
55 (let* ((ls '(1 2 3 4 5 6 7 8 9))
56 (a (make-array (length ls
)
57 :element-type
'(complex single-float
)
58 :initial-contents
(mapcar
59 #'(lambda (z) (coerce z
60 '(complex single-float
)))
66 (let ((a (make-array (list 128 128 128)
67 :element-type
'(complex single-float
))))