[Gsll-devel] Added evaluate-integral-example

Mirko Vukovic mirko.vukovic at gmail.com
Wed Nov 11 12:46:47 UTC 2009


Hi,

I have added the following example of `evaluate-integral' to
spline-example.lisp:

(defun evaluate-integral-example (&optional (intervals 4))
  "Evaluate integral of sin(x) in interval 0-pi.  sin(x) is tabulated
over a 0-2pi interval and interpolated with
+periodic-cubic-spline-interpolation+"
  (let* ((nodes (1+ intervals))
     (max-node (1- nodes))
     (xarr
      (loop
         with step = (/ (* 2.0 pi) intervals)
         for i from 0 upto max-node
         collect (* i step)))
     (xmarr (make-marray 'double-float :initial-contents xarr))
     ;; cannot use (loop for x on (cl-array xmarr)...) -- c function gives
error
     (ymarr
      (make-marray 'double-float :initial-contents
               (loop for x in xarr
              collect (sin x))))
     (acc (make-acceleration))
     (spline (make-spline +periodic-cubic-spline-interpolation+ xmarr
ymarr)))
  (evaluate-integral spline 0d0 (coerce pi 'double-float) :acceleration
acc)))

Right now it is sitting in the `master' branch on my laptop.  How would you
like me to upload it.  As a master, or something else?

Mirko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/gsll-devel/attachments/20091111/e77ec003/attachment.html>


More information about the gsll-devel mailing list