diff --git a/histogram/updating-accessing.lisp b/histogram/updating-accessing.lisp index ca3f81b1a942af59cf249d2070284aec74d1561c..1c83e56dfa9f3a5d40fb03f9bd9e2c719fa65ee4 100644 --- a/histogram/updating-accessing.lisp +++ b/histogram/updating-accessing.lisp @@ -1,8 +1,8 @@ ;; Updating and accessing histogram elements. ;; Liam Healy, Mon Jan 1 2007 - 14:43 -;; Time-stamp: <2011-05-26 12:37:35EDT updating-accessing.lisp> +;; Time-stamp: <2011-09-12 17:35:27EDT updating-accessing.lisp> ;; -;; Copyright 2007, 2008, 2009 Liam M. Healy +;; Copyright 2007, 2008, 2009, 2011 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; This program is free software: you can redistribute it and/or modify @@ -23,6 +23,9 @@ ;;; /usr/include/gsl/gsl_histogram.h ;;; /usr/include/gsl/gsl_histogram2d.h +;;; Missing: 2D functions/methods; the 1D functions will need to be made into methods if not already. +;;; http://www.gnu.org/s/gsl/manual/html_node/Updating-and-accessing-2D-histogram-elements.html + (defmfun increment (histogram value &optional weight) ("gsl_histogram_increment" "gsl_histogram_accumulate") ((((mpointer histogram) :pointer) (value :double)) @@ -82,16 +85,19 @@ :documentation ; FDL "The minimum lower range limit of the histogram.") -(defmfun bins (histogram) +(defmfun grid:dimensions ((histogram histogram)) "gsl_histogram_bins" (((mpointer histogram) :pointer)) - :c-return sizet + :definition :method + :c-return (dim sizet) + :return ((list dim)) :documentation ; FDL "The number of bins in the histogram.") -(defmfun reset (histogram) +(defmfun set-zero ((histogram histogram)) "gsl_histogram_reset" (((mpointer histogram) :pointer)) + :definition :method :c-return :void :documentation ; FDL "Reset all the bins in the histogram to zero.") @@ -153,7 +159,7 @@ (set-ranges-uniform histo 0.0d0 10.0d0) (increment histo 2.7d0) (increment histo 6.9d0 2.0d0) - (bins histo)) + (grid:dimensions histo)) (let ((histo (make-histogram 10))) (set-ranges-uniform histo 0.0d0 10.0d0) (increment histo 2.7d0) diff --git a/tests/histogram.lisp b/tests/histogram.lisp index d37108b1954cb5cc561f3753ff30f841d3268c85..993c6c0a813378a00423fe6d2f8d1df51d6e3988 100644 --- a/tests/histogram.lisp +++ b/tests/histogram.lisp @@ -107,7 +107,7 @@ (INCREMENT HISTO 6.9d0 2.0d0) - (BINS HISTO)))) + (first (grid:dimensions HISTO))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL (LIST 5) (MULTIPLE-VALUE-LIST (LET ((HISTO