| 1 | ;; Index lookup and acceleration |
|---|
| 2 | ;; Liam Healy, Sun Nov 4 2007 - 18:09 |
|---|
| 3 | ;; Time-stamp: <2008-02-17 17:50:25EST lookup.lisp> |
|---|
| 4 | ;; $Id$ |
|---|
| 5 | |
|---|
| 6 | (in-package :gsl) |
|---|
| 7 | |
|---|
| 8 | (defgo-s (acceleration) allocate-acceleration free-acceleration nil 0) |
|---|
| 9 | |
|---|
| 10 | (defmfun interpolation-search (x-array x low-index high-index) |
|---|
| 11 | "gsl_interp_bsearch" |
|---|
| 12 | ((x-array :pointer) (x :double) (low-index size) (high-index size)) |
|---|
| 13 | :c-return size |
|---|
| 14 | :documentation ; FDL |
|---|
| 15 | "Find the index i of the array x-array such |
|---|
| 16 | that x-array[i] <= x < x-array[i+1]. The index is searched for |
|---|
| 17 | in the range [low-index, high-index].") |
|---|
| 18 | |
|---|
| 19 | (defmfun allocate-acceleration () |
|---|
| 20 | "gsl_interp_accel_alloc" |
|---|
| 21 | () |
|---|
| 22 | :c-return :pointer |
|---|
| 23 | :export nil |
|---|
| 24 | :index (letm acceleration) |
|---|
| 25 | :documentation ; FDL |
|---|
| 26 | "Allocate an accelerator object, which is a |
|---|
| 27 | kind of iterator for interpolation lookups. It tracks the state of |
|---|
| 28 | lookups, thus allowing for application of various acceleration |
|---|
| 29 | strategies.") |
|---|
| 30 | |
|---|
| 31 | (defmfun accelerated-interpolation-search (x-array x acceleration) |
|---|
| 32 | "gsl_interp_accel_find" |
|---|
| 33 | ((acceleration :pointer) (x-array :pointer) (x :double)) |
|---|
| 34 | :c-return size |
|---|
| 35 | :documentation ; FDL |
|---|
| 36 | "Search the data array x-array of size, using the given acceleration. |
|---|
| 37 | This is how lookups are performed during evaluation of an interpolation. The |
|---|
| 38 | function returns an index i such that x_array[i] <= x < x_array[i+1]}.") |
|---|
| 39 | |
|---|
| 40 | (defmfun free-acceleration (acceleration) |
|---|
| 41 | "gsl_interp_accel_free" |
|---|
| 42 | ((acceleration :pointer)) |
|---|
| 43 | :export nil |
|---|
| 44 | :index (letm acceleration) |
|---|
| 45 | :c-return :void |
|---|
| 46 | :documentation ; FDL |
|---|
| 47 | "Frees the accelerator object.") |
|---|