lookup.lisp 1.22 KB
Newer Older
liam's avatar
liam committed
1 2
;; Index lookup and acceleration
;; Liam Healy, Sun Nov  4 2007 - 18:09
3
;; Time-stamp: <2009-01-25 10:14:47EST lookup.lisp>
lhealy's avatar
lhealy committed
4
;; $Id$
5 6 7

(in-package :gsl)

8 9
(defmobject acceleration "gsl_interp_accel"
  ()
10 11
  "acceleration for interpolation"
  :documentation			; FDL
12
  "Make an accelerator object, which is a
13 14 15 16
   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
17
(defmfun interpolation-search (x-array x low-index high-index)
18
  "gsl_interp_bsearch"
Liam Healy's avatar
Liam Healy committed
19 20
  ((x-array :pointer) (x :double) (low-index sizet) (high-index sizet))
  :c-return sizet
liam's avatar
liam committed
21 22 23
  :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
24 25
   in the range [low-index, high-index].")

liam's avatar
liam committed
26
(defmfun accelerated-interpolation-search (x-array x acceleration)
27
  "gsl_interp_accel_find"
28
  (((mpointer acceleration) :pointer) (x-array :pointer) (x :double))
Liam Healy's avatar
Liam Healy committed
29
  :c-return sizet
liam's avatar
liam committed
30 31 32 33
  :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]}.")