Commit 425fa53d authored by Raymond Toy's avatar Raymond Toy
Browse files

Fix to handle odd FFT lengths

parent 284a108b
...@@ -80,10 +80,11 @@ ...@@ -80,10 +80,11 @@
(nhalf (floor (/ n 2))) (nhalf (floor (/ n 2)))
(out (make-array (+ 1 nhalf) :element-type '(complex single-float)))) (out (make-array (+ 1 nhalf) :element-type '(complex single-float))))
(setf (aref out 0) (complex (aref x 0) 0.0)) (setf (aref out 0) (complex (aref x 0) 0.0))
(loop for j from 1 to (1- nhalf) (loop for j from 1 to (if (evenp n) (1- nhalf) nhalf)
for k from 1 by 2
do do
(setf (aref out j) (complex (* 0.5 (aref x (1- (* 2 j)))) (setf (aref out j) (complex (* 0.5 (aref x k))
(* 0.5 (aref x (* 2 j)))))) (* 0.5 (aref x (1+ k))))))
(when (evenp n) (when (evenp n)
(setf (aref out nhalf) (setf (aref out nhalf)
(complex (aref x (1- n)) 0.0))) (complex (aref x (1- n)) 0.0)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment