23.03.2013 Views

Performance and Evaluation of Lisp Systems - Dreamsongs

Performance and Evaluation of Lisp Systems - Dreamsongs

Performance and Evaluation of Lisp Systems - Dreamsongs

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

194<br />

l6 (cond ((< k j)<br />

(setq j (- j k) k (/ k 2))<br />

(go l6)))<br />

(setq j (+ j k)<br />

i (1+ i))<br />

(cond ((< i n)<br />

(go l3)))<br />

;;; loop thru stages<br />

(do ((l 1 (1+ l)))<br />

((> l m))<br />

(setq le (expt 2 l)<br />

le1 (floor le 2) ur 1.0<br />

ui 0. wr (cos (/ pi (float le1)))<br />

wi (sin (/ pi (float le1))))<br />

;;; loop thru butterflies<br />

(do ((j 1 (1+ j)))<br />

((> j le1))<br />

;;; do a butterfly<br />

(do ((i j (+ i le)))<br />

((> i n))<br />

(setq ip (+ i le1)<br />

tr (- (* (aref ar ip) ur)<br />

(* (aref ai ip) ui))<br />

ti (+ (* (aref ar ip) ui)<br />

(* (aref ai ip) ur)))<br />

(setf (aref ar ip) (- (aref ar i) tr))<br />

(setf (aref ai ip) (- (aref ai i) ti))<br />

(setf (aref ar i) (+ (aref ar i) tr))<br />

(setf (aref ai i) (+ (aref ai i) ti))))<br />

(setq tr (- (* ur wr) (* ui wi))<br />

ti (+ (* ur wi) (* ui wr))<br />

ur tr ui ti))<br />

(return t)))<br />

;;; the timer, which does 10 calls on fft<br />

(defmacro fft-bench ()<br />

’(do ((ntimes 0 (1+ ntimes)))<br />

((= ntimes 10.))<br />

(fft re im)))<br />

;;; call: (fft-bench)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!