Commit de942c32 authored by Liam Healy's avatar Liam Healy

Definition of grid:gref* for histogram

Define method grid:gref* for histograms; it was a definition of
grid:gref, but with the compiler macro that turns that into
grid:gref*, we need it to be a definition of grid:gref* instead.
Removed the definition of +foreign-array-pointer+ and
+foreign-array-type+ to the grid package.
parent 7f2a48ac
;; Permutations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2010-07-16 17:14:45EDT permutation.lisp>
;; Time-stamp: <2010-11-13 18:44:09EST permutation.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -218,7 +218,7 @@
have the same length.")
(defmfun permute
(p (data #.+foreign-pointer-class+) &optional (size 1) (stride 1))
(p (data #.grid:+foreign-pointer-class+) &optional (size 1) (stride 1))
"gsl_permute"
(((mpointer p) :pointer) (data :pointer) (stride sizet) (size sizet))
:definition :method
......@@ -246,7 +246,7 @@
have the same length.")
(defmfun permute-inverse
(p (data #.+foreign-pointer-class+) &optional (size 1) (stride 1))
(p (data #.grid:+foreign-pointer-class+) &optional (size 1) (stride 1))
"gsl_permute_inverse"
(((mpointer p) :pointer) (data :pointer) (stride sizet) (stride sizet))
:definition :method
......
;; The histogram structure
;; Liam Healy, Mon Jan 1 2007 - 11:32
;; Time-stamp: <2010-07-16 17:10:12EDT histogram.lisp>
;; Time-stamp: <2010-11-13 19:24:22EST histogram.lisp>
;;
;; Copyright 2007, 2008, 2009, 2010 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -28,7 +28,7 @@
(defmobject histogram
"gsl_histogram"
((number-of-bins sizet))
"one-dimensional histogram, including bin boundaries and bin contents."
"one-dimensional histogram, including bin boundaries and bin contents"
:initialize-suffix "set_ranges"
:initialize-args (((foreign-pointer ranges) :pointer) ((dim0 ranges) sizet)))
......
;; Updating and accessing histogram elements.
;; Liam Healy, Mon Jan 1 2007 - 14:43
;; Time-stamp: <2010-06-30 21:02:26EDT updating-accessing.lisp>
;; Time-stamp: <2010-11-13 19:26:08EST updating-accessing.lisp>
;;
;; Copyright 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -42,14 +42,15 @@
histograms for a small range of a larger dataset, ignoring the values
outside the range of interest.")
(defmfun grid:gref ((histogram histogram) &rest indices)
(defmfun grid:gref* ((histogram histogram) index)
"gsl_histogram_get"
(((mpointer histogram) :pointer) ((first indices) sizet))
(((mpointer histogram) :pointer) (index sizet))
:definition :method
:c-return :double
:index grid:gref
:documentation ; FDL
"Return the contents of the i-th bin of the histogram.
If i lies outside the valid range of indices for the
If i lies outside the valid range of index for the
histogram then an error (input-domain) is signalled.")
(defmfun range (histogram i)
......
;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21
;; Time-stamp: <2010-07-15 22:33:56EDT mobject.lisp>
;; Time-stamp: <2010-11-13 18:22:18EST mobject.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -317,29 +317,22 @@
(defgeneric evaluate (object point &key #+sbcl &allow-other-keys)
(:documentation "Evaluate the GSL object."))
;;; Pointer type
(eval-when (:compile-toplevel :load-toplevel :execute)
(defconstant +foreign-pointer-class+ (class-name (class-of (cffi:null-pointer)))
"The class in which foreign pointers fall.")
(defconstant +foreign-pointer-type+ (type-of (cffi:null-pointer))
"The type of foreign pointers."))
;;; Note: clisp has a foreign pointer class = T, so it would be best
;;; to narrow down methods that dispatch on this class.
(defmacro foreign-pointer-method (pointer form)
"Execute this form only if the pointer is of +foreign-pointer-type+;
"Execute this form only if the pointer is of grid:+foreign-pointer-type+;
otherwise call the next method."
#-clisp (declare (ignore pointer))
#+clisp
`(if (typep ,pointer +foreign-pointer-type+)
`(if (typep ,pointer grid:+foreign-pointer-type+)
,form
(call-next-method))
#-clisp
form)
;;; Is this obsolete? We no longer handle raw pointers.
(defmethod mpointer ((object #.+foreign-pointer-class+))
#+clisp (check-type object #.+foreign-pointer-type+)
(defmethod mpointer ((object #.grid:+foreign-pointer-class+))
#+clisp (check-type object #.grid:+foreign-pointer-type+)
object)
(export 'order)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment