root/trunk/interpolation/interpolation.lisp

Revision 26, 2.7 kB (checked in by lhealy, 9 months ago)

Subversion version stamp.

  • Property svn:keywords set to Id
Line 
1;; Interpolation allocation, initialization, and freeing.
2;; Liam Healy, Sun Nov  4 2007 - 17:24
3;; Time-stamp: <2008-02-17 17:45:18EST interpolation.lisp>
4;; $Id$
5
6(in-package :gsl)
7
8;;; A spline is an interpolation that also stores the arrays xa and ya,
9;;; so they need not be supplied on each call.
10
11(defgo interpolation (type xa-or-size &optional ya)
12  (list
13   `(allocate-interpolation ,type ,(if ya `(dim0 ,ya) xa-or-size))
14   'free-spline
15   (when ya
16     (lambda (symb)
17       `(initialize-interpolation ,symb ,xa-or-size ,ya)))))
18
19;;; Interpolation
20(defmfun allocate-interpolation (type size)
21  "gsl_interp_alloc"
22  ((type :pointer) (size size))
23  :c-return :pointer
24  :export nil
25  :index (letm interpolation)
26  :documentation                        ; FDL
27  "Allocate an interpolation object of type for size data-points,
28   and return the pointer to it.")
29
30(defmfun initialize-interpolation (interpolation xa ya)
31  "gsl_interp_init"
32  ((interpolation :pointer)
33   ((gsl-array xa) :pointer) ((gsl-array ya) :pointer) ((dim0 xa) size))
34  :documentation                        ; FDL
35  "Initialize the interpolation object interp for the
36  data (xa,ya) where xa and ya are gsl-arrays.  The interpolation object does not save
37  the data arrays xa and ya and only stores the static state
38  computed from the data.  The xa data array is always assumed to be
39  strictly ordered; the behavior for other arrangements is not defined.")
40
41(defmfun free-interpolation (interpolation)
42  "gsl_interp_free"
43  ((interpolation :pointer))
44  :c-return :void
45  :export nil
46  :index (letm interpolation)
47  :documentation                        ; FDL
48  "Frees the interpolation object interp.")
49
50(defgo spline (type xa-or-size &optional ya)
51  (list
52   `(allocate-spline ,type ,(if ya `(dim0 ,ya) xa-or-size))
53   'free-spline
54   (when ya
55     (lambda (symb)
56       `(initialize-spline ,symb ,xa-or-size ,ya)))))
57
58;;; Spline
59(defmfun allocate-spline (type size)
60  "gsl_spline_alloc"
61  ((type :pointer) (size size))
62  :c-return :pointer
63  :documentation                        ; FDL
64  "Allocate an interpolation object of type for size data-points,
65   and return the pointer to it.")
66
67(defmfun initialize-spline (interpolation xa ya)
68  "gsl_spline_init"
69  ((interpolation :pointer)
70   ((gsl-array xa) :pointer) ((gsl-array ya) :pointer) ((dim0 xa) size))
71  :documentation                        ; FDL
72  "Initialize the interpolation object interp for the
73  data (xa,ya) where xa and ya are gsl-arrays.  The spline object saves
74  the data arrays xa and ya computed from the data.
75  The xa data array is always assumed to be
76  strictly ordered; the behavior for other arrangements is not defined.")
77
78(defmfun free-spline (interpolation)
79  "gsl_spline_free"
80  ((interpolation :pointer))
81  :c-return :void
82  :documentation                        ; FDL
83  "Frees the spline object.")
Note: See TracBrowser for help on using the browser.