Skip to content
Snippets Groups Projects
lookup.lisp 1.54 KiB
Newer Older
liam's avatar
liam committed
;; Index lookup and acceleration
;; Liam Healy, Sun Nov  4 2007 - 18:09
;; Time-stamp: <2008-02-17 17:50:25EST lookup.lisp>
lhealy's avatar
lhealy committed
;; $Id$
(defgo-s (acceleration) allocate-acceleration free-acceleration nil 0)
liam's avatar
liam committed
(defmfun interpolation-search (x-array x low-index high-index)
liam's avatar
liam committed
  ((x-array :pointer) (x :double) (low-index size) (high-index size))
  :c-return size
  :documentation			; FDL
  "Find the index i of the array x-array such
   that x-array[i] <= x < x-array[i+1].  The index is searched for
   in the range [low-index, high-index].")

liam's avatar
liam committed
(defmfun allocate-acceleration ()
  "gsl_interp_accel_alloc"
  ()
  :c-return :pointer
  :index (letm acceleration)
liam's avatar
liam committed
  :documentation			; FDL
  "Allocate an accelerator object, which is a
   kind of iterator for interpolation lookups.  It tracks the state of
   lookups, thus allowing for application of various acceleration
   strategies.")

liam's avatar
liam committed
(defmfun accelerated-interpolation-search (x-array x acceleration)
  "gsl_interp_accel_find"
  ((acceleration :pointer) (x-array :pointer) (x :double))
liam's avatar
liam committed
  :c-return size
  :documentation			; FDL
  "Search the data array x-array of size, using the given acceleration.
   This is how lookups are performed during evaluation of an interpolation.  The
   function returns an index i such that x_array[i] <= x < x_array[i+1]}.")
liam's avatar
liam committed
(defmfun free-acceleration (acceleration)
  "gsl_interp_accel_free"
  ((acceleration :pointer))
  :index (letm acceleration)
liam's avatar
liam committed
  :documentation			; FDL
  "Frees the accelerator object.")