[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Number crunching in CLISP.



Thank you, Bruno Haible & Marcus Daniels for pointing out that it's
easy to get CLISP to use the FPU, and how to do it.  Marcus raised
questions as to what kind of code I will be using in his comment:

 > For this excruciatingly unrealistic code, I think it is the short answer is
 > "You can't".  Write portions of it in C.  Use the approach described
 > in foreign.txt (or ask me to point you to the alpha CLISP with FFI).


The kind of code I'm considering basically is solving recursive
functions.  I might have something like:

(defun value (level node)
  (cond ((= level *MAX_LEVEL*) 100)
	(t (let ((p1 (complicate-expression-involving-exponentials))
		 (p2 (complicate-expression-involving-exponentials))
		 (p3 (- 1 p1 p2)))
	     (* (exp (* (aref *RATE* level) (aref *DT* level)))
		(+ (* p1 (value (+1 level) (+1 node)))
		   (* p2 (value (+1 level) node))
		   (* p3 (value (+1 level) (-1 node)))))))))

where I need to compute (value 0 0) for various values of *RATE* and
*DT*.  This is very simplified & off the top of my head, but is
basically the kind of thing we're looking at.  The real thing would
have more conditionals embedded in & afew more array references.

We have some functions individually coded in FORTRAN which takes maybe
a couple of seconds to compute (on a 486dx-66).  Adding new functions
in FORTRAN is a mess, so I'd like to code a system for investigating
functions of this form in LISP.  Investigating these functions
involves plotting their value as a function of various input
parameters.  I usually use around 300 points, thus taking about 5
minutes per graph.  Then, varying a bunch of other input parameters, I
end up with maybe 60 graphs to look at, thus taking about 5 hours to
generate, which I spread around 5 machines so that I can look at them
in an hour.

My dream is to code this in LISP & get it to run comparably.  Then,
maybe I wouldn't even have to recode it.  If I can code this in LISP &
get even reasonable speed, then that will be good enough for general
testing & some comparative analysis.

Thanks,

Harvey J. Stein
Berger Financial Research
hjstein@math.huji.ac.il