From mmommer at common-lisp.net Mon May 9 20:25:13 2005 From: mmommer at common-lisp.net (Mario Mommer) Date: Mon, 9 May 2005 22:25:13 +0200 (CEST) Subject: [sapaclisp-cvs] CVS update: Module imported: sapaclisp Message-ID: <20050509202513.701638871A@common-lisp.net> Update of /project/sapaclisp/cvsroot/sapaclisp In directory common-lisp.net:/tmp/cvs-serv14361 Log Message: Initial Checkin Status: Vendor Tag: T Release Tags: initial_checkin N sapaclisp/COPYING N sapaclisp/acvs.lisp N sapaclisp/hacks.lisp N sapaclisp/matrix.lisp N sapaclisp/basic-math.lisp N sapaclisp/dft-and-fft.lisp N sapaclisp/basic-statistics.lisp N sapaclisp/examples.lisp N sapaclisp/filtering.lisp N sapaclisp/harmonic.lisp N sapaclisp/multitaper.lisp N sapaclisp/nonparametric.lisp N sapaclisp/parametric.lisp N sapaclisp/random.lisp N sapaclisp/sapaclisp.asd N sapaclisp/sapa-package.lisp N sapaclisp/tapers.lisp N sapaclisp/utilities.lisp No conflicts created by this import Date: Mon May 9 22:25:11 2005 Author: mmommer New module sapaclisp added From mmommer at common-lisp.net Mon May 16 09:07:36 2005 From: mmommer at common-lisp.net (Mario Mommer) Date: Mon, 16 May 2005 11:07:36 +0200 (CEST) Subject: [sapaclisp-cvs] CVS update: sapaclisp/dft-and-fft.lisp Message-ID: <20050516090736.56A47880DF@common-lisp.net> Update of /project/sapaclisp/cvsroot/sapaclisp In directory common-lisp.net:/tmp/cvs-serv29351/sapaclisp Modified Files: dft-and-fft.lisp Log Message: Litle stylistic nitpick Date: Mon May 16 11:07:35 2005 Author: mmommer Index: sapaclisp/dft-and-fft.lisp diff -u sapaclisp/dft-and-fft.lisp:1.1.1.1 sapaclisp/dft-and-fft.lisp:1.2 --- sapaclisp/dft-and-fft.lisp:1.1.1.1 Mon May 9 22:24:34 2005 +++ sapaclisp/dft-and-fft.lisp Mon May 16 11:07:35 2005 @@ -156,11 +156,11 @@ ; 2.220446049250313E-16 |# -;------------------------------------------------------------------------------- +;----------------------------------------------------------------------------- ;;; used by the following routine fft! -(defparameter +use-pre-fft-with-cache-p+ t) +(defparameter *use-pre-fft-with-cache-p* t) -;------------------------------------------------------------------------------- +;----------------------------------------------------------------------------- ;;; The following code is a Lisp version (with modifications) of ;;; the FFT routines on pages 54--6 of ``Digital Spectral Analysis with ;;; Applications'' by Marple, 1987. The function fft! only works @@ -173,7 +173,7 @@ ;;; X(k) = SUM x(n) exp(-i 2 pi n k/N) ;;; n=0 ;;; -;;; If +use-pre-fft-with-cache-p+ is true, the complex exponential table +;;; If *use-pre-fft-with-cache-p* is true, the complex exponential table ;;; for N=2^P is stored in an array of length N pointed to by the P-th element ;;; of *sapa-cached-pre-fft-arrays*. The intent here is to speed things up ;;; and reduce garbage collection (at the expense of extra storage), but the @@ -199,7 +199,7 @@ Note: see Equation (110a) of the SAPA book with the sampling time set to unity" (let ((exponent (power-of-2 n)) - (W (if +use-pre-fft-with-cache-p+ + (W (if *use-pre-fft-with-cache-p* (pre-fft-with-cache n) (pre-fft n))) (MM 1) From mmommer at common-lisp.net Mon May 16 09:19:23 2005 From: mmommer at common-lisp.net (Mario Mommer) Date: Mon, 16 May 2005 11:19:23 +0200 (CEST) Subject: [sapaclisp-cvs] CVS update: sapaclisp/sapa-package.lisp Message-ID: <20050516091923.0E3F8880DF@common-lisp.net> Update of /project/sapaclisp/cvsroot/sapaclisp In directory common-lisp.net:/tmp/cvs-serv30205/sapaclisp Modified Files: sapa-package.lisp Log Message: Hack no longer needed, at least not with a system definition facility Date: Mon May 16 11:19:23 2005 Author: mmommer Index: sapaclisp/sapa-package.lisp diff -u sapaclisp/sapa-package.lisp:1.1.1.1 sapaclisp/sapa-package.lisp:1.2 --- sapaclisp/sapa-package.lisp:1.1.1.1 Mon May 9 22:25:06 2005 +++ sapaclisp/sapa-package.lisp Mon May 16 11:19:23 2005 @@ -22,7 +22,5 @@ ; contribution to StatLib. ; ;------------------------------------------------------------------------------ -(in-package :CL-USER) -(if (not (find-package :SAPA)) - (defpackage :SAPA (:USE :COMMON-LISP))) +(defpackage :SAPA (:USE :COMMON-LISP)) From mmommer at common-lisp.net Mon May 16 09:59:12 2005 From: mmommer at common-lisp.net (Mario Mommer) Date: Mon, 16 May 2005 11:59:12 +0200 (CEST) Subject: [sapaclisp-cvs] CVS update: sapaclisp/dft-and-fft.lisp Message-ID: <20050516095912.CF3D8880DF@common-lisp.net> Update of /project/sapaclisp/cvsroot/sapaclisp In directory common-lisp.net:/tmp/cvs-serv32056/sapaclisp Modified Files: dft-and-fft.lisp Log Message: Substituted the recurrence relation used for computing the sines and cosines needed by the FFT. The new one is more stable. (Thanks to B. Lucier) Date: Mon May 16 11:59:12 2005 Author: mmommer Index: sapaclisp/dft-and-fft.lisp diff -u sapaclisp/dft-and-fft.lisp:1.2 sapaclisp/dft-and-fft.lisp:1.3 --- sapaclisp/dft-and-fft.lisp:1.2 Mon May 16 11:07:35 2005 +++ sapaclisp/dft-and-fft.lisp Mon May 16 11:59:12 2005 @@ -337,21 +337,30 @@ ;------------------------------------------------------------------------------- ;;; Everything below here consists of internal symbols in the SAPA package ;;; and should be regarded as "dirty laundry" ... -;------------------------------------------------------------------------------- -;------------------------------------------------------------------------------- -(defun pre-fft - (n - &key - (complex-exp-vector nil)) - (if (power-of-2 n) +;----------------------------------------------------------------------------- +;----------------------------------------------------------------------------- +(defun pre-fft (n &key (complex-exp-vector nil)) + "Computes a vector with the cosines and sines needed for the FFT" + (when (power-of-2 n) (let* ((the-vector (if complex-exp-vector complex-exp-vector - (make-array n))) + (make-array n + :element-type '(complex double-float)))) (s (/ (* 2 pi) n)) - (c1 (complex (cos s) (- (sin s)))) - (c2 (complex 1.0d0 0.0d0))) + (2sdh (* 2 (expt (sin (/ s 2)) 2))) + (sd (sin s)) + (sk 0.0d0) + (ck 1.0d0)) + (declare (double-float ck sk sd 2sdh)) + (dotimes (i n the-vector) - (setf (aref the-vector i) c2 - c2 (* c2 c1)))))) + (setf (aref the-vector i) + (complex ck sk) + + (values ck sk) + (values (- ck (* sk sd) (* ck 2sdh)) + (+ sk (* ck sd) (* (- sk) 2sdh)))))))) + + ;------------------------------------------------------------------------------- ;;; saves results up to size (expt 2 31) = 2147483648 From mmommer at common-lisp.net Mon May 16 11:37:07 2005 From: mmommer at common-lisp.net (Mario Mommer) Date: Mon, 16 May 2005 13:37:07 +0200 (CEST) Subject: [sapaclisp-cvs] CVS update: sapaclisp/dft-and-fft.lisp Message-ID: <20050516113707.A7B768871A@common-lisp.net> Update of /project/sapaclisp/cvsroot/sapaclisp In directory common-lisp.net:/tmp/cvs-serv6047 Modified Files: dft-and-fft.lisp Log Message: Svref works no longer here. Date: Mon May 16 13:37:05 2005 Author: mmommer Index: sapaclisp/dft-and-fft.lisp diff -u sapaclisp/dft-and-fft.lisp:1.3 sapaclisp/dft-and-fft.lisp:1.4 --- sapaclisp/dft-and-fft.lisp:1.3 Mon May 16 11:59:12 2005 +++ sapaclisp/dft-and-fft.lisp Mon May 16 13:37:05 2005 @@ -220,7 +220,7 @@ ((> NN 1) (do ((j 1 (1+ j))) ((>= j NN)) - (setf c2 (svref W JJ)) + (setf c2 (aref W JJ)) (do* ((i j (+ i LL)) (kk (+ j NN) (+ i NN))) ((>= i N))