[Gsll-devel] patch for calculus/monte-carlo.lisp

Sam Steingold sds at gnu.org
Wed Jul 28 20:58:02 UTC 2010


PI has type long-float, not double-float, so the following patch is necessary:
=========================================================
diff --git a/calculus/monte-carlo.lisp b/calculus/monte-carlo.lisp
index cb18bb1..32bae65 100644
--- a/calculus/monte-carlo.lisp
+++ b/calculus/monte-carlo.lisp
@@ -211,7 +211,8 @@
 (defparameter *mc-lower* #m(0.0d0 0.0d0 0.0d0))

 (defparameter *mc-upper*
-  (grid:make-foreign-array 'double-float :initial-contents (list pi pi pi)))
+  (grid:make-foreign-array 'double-float :initial-contents
+                           (list #1=#.(float pi 0d0) #1# #1#)))

 (defun random-walk-plain-example (&optional (nsamples 500000))
   (monte-carlo-integrate-plain 'mcrw *mc-lower* *mc-upper* nsamples))
=========================================================
alternatively, you may need to call COERCE in grid:make-foreign-array
or something.

-- 
Sam Steingold <http://sds.podval.org>




More information about the gsll-devel mailing list