;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LUSH Lisp Universal Shell
;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
;;; Includes parts of TL3:
;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
;;; Includes selected parts of SN3.2:
;;;   Copyright (C) 1991-2001 AT&T Corp.
;;;
;;; Includes information derived from the GSL (Gnu Scientific Library)
;;;   header files which are copyrighted and distributed under the GPL
;;;   by their respective authors.
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(libload "gsl/gsl-config")



#? *** histogram

;; dummy function that adds GSL C header files in C file
(eval `(de dummy_histogram () ,gsl-cpheader-cmd ()))

#? * (dummy_histogram)
#? * (gsl_histogram_alloc <n>)
#? * (gsl_histogram_calloc <n>)
#? * (gsl_histogram_calloc_uniform <n> <xmin> <xmax>)
#? * (gsl_histogram_free <h>)
#? * (gsl_histogram_increment <h> <x>)
#? * (gsl_histogram_accumulate <h> <x> <weight>)
#? * (gsl_histogram_find <h> <x> <i>)
#? * (gsl_histogram_get <h> <i>)
#? * (gsl_histogram_get_range <h> <i> <lower> <upper>)
#? * (gsl_histogram_max <h>)
#? * (gsl_histogram_min <h>)
#? * (gsl_histogram_bins <h>)
#? * (gsl_histogram_reset <h>)
#? * (gsl_histogram_calloc_range <n> <range>)
#? * (gsl_histogram_set_ranges <h> <range> <size>)
#? * (gsl_histogram_set_ranges_uniform <h> <xmin> <xmax>)
#? * (gsl_histogram_memcpy <dest> <source>)
#? * (gsl_histogram_clone <source>)
#? * (gsl_histogram_max_val <h>)
#? * (gsl_histogram_max_bin <h>)
#? * (gsl_histogram_min_val <h>)
#? * (gsl_histogram_min_bin <h>)
#? * (gsl_histogram_equal_bins_p <h1> <h2>)
#? * (gsl_histogram_add <h1> <h2>)
#? * (gsl_histogram_sub <h1> <h2>)
#? * (gsl_histogram_mul <h1> <h2>)
#? * (gsl_histogram_div <h1> <h2>)
#? * (gsl_histogram_scale <h> <scale>)
#? * (gsl_histogram_shift <h> <shift>)
#? * (gsl_histogram_sigma <h>)
#? * (gsl_histogram_mean <h>)
#? * (gsl_histogram_sum <h>)
#? * (gsl_histogram_fwrite <stream> <h>)
#? * (gsl_histogram_fread <stream> <h>)
#? * (gsl_histogram_fprintf <stream> <h> <range_format> <bin_format>)
#? * (gsl_histogram_fscanf <stream> <h>)
#? * (gsl_histogram_pdf_alloc <n>)
#? * (gsl_histogram_pdf_init <p> <h>)
#? * (gsl_histogram_pdf_free <p>)
#? * (gsl_histogram_pdf_sample <p> <r>)
#? * (gsl_histogram2d_alloc <nx> <ny>)
#? * (gsl_histogram2d_calloc <nx> <ny>)
#? * (gsl_histogram2d_calloc_uniform <nx> <ny> <xmin> <xmax> <ymin> <ymax>)
#? * (gsl_histogram2d_free <h>)
#? * (gsl_histogram2d_increment <h> <x> <y>)
#? * (gsl_histogram2d_accumulate <h> <x> <y> <weight>)
#? * (gsl_histogram2d_find <h> <x> <y> <i> <j>)
#? * (gsl_histogram2d_get <h> <i> <j>)
#? * (gsl_histogram2d_get_xrange <h> <i> <xlower> <xupper>)
#? * (gsl_histogram2d_get_yrange <h> <j> <ylower> <yupper>)
#? * (gsl_histogram2d_xmax <h>)
#? * (gsl_histogram2d_xmin <h>)
#? * (gsl_histogram2d_nx <h>)
#? * (gsl_histogram2d_ymax <h>)
#? * (gsl_histogram2d_ymin <h>)
#? * (gsl_histogram2d_ny <h>)
#? * (gsl_histogram2d_reset <h>)
#? * (gsl_histogram2d_calloc_range <nx> <ny> <xrange> <yrange>)
#? * (gsl_histogram2d_set_ranges_uniform <h> <xmin> <xmax> <ymin> <ymax>)
#? * (gsl_histogram2d_set_ranges <h> <xrange> <xsize> <yrange> <ysize>)
#? * (gsl_histogram2d_memcpy <dest> <source>)
#? * (gsl_histogram2d_clone <source>)
#? * (gsl_histogram2d_max_val <h>)
#? * (gsl_histogram2d_max_bin <h> <i> <j>)
#? * (gsl_histogram2d_min_val <h>)
#? * (gsl_histogram2d_min_bin <h> <i> <j>)
#? * (gsl_histogram2d_xmean <h>)
#? * (gsl_histogram2d_ymean <h>)
#? * (gsl_histogram2d_xsigma <h>)
#? * (gsl_histogram2d_ysigma <h>)
#? * (gsl_histogram2d_cov <h>)
#? * (gsl_histogram2d_sum <h>)
#? * (gsl_histogram2d_equal_bins_p <h1> <h2>)
#? * (gsl_histogram2d_add <h1> <h2>)
#? * (gsl_histogram2d_sub <h1> <h2>)
#? * (gsl_histogram2d_mul <h1> <h2>)
#? * (gsl_histogram2d_div <h1> <h2>)
#? * (gsl_histogram2d_scale <h> <scale>)
#? * (gsl_histogram2d_shift <h> <shift>)
#? * (gsl_histogram2d_fwrite <stream> <h>)
#? * (gsl_histogram2d_fread <stream> <h>)
#? * (gsl_histogram2d_fprintf <stream> <h> <range_format> <bin_format>)
#? * (gsl_histogram2d_fscanf <stream> <h>)
#? * (gsl_histogram2d_pdf_alloc <nx> <ny>)
#? * (gsl_histogram2d_pdf_init <p> <h>)
#? * (gsl_histogram2d_pdf_free <p>)
#? * (gsl_histogram2d_pdf_sample <p> <r1> <r2> <x> <y>)

;; ********************************************************

;;;;****************************************************************************
;;;;               gsl_histogram

(de gsl_histogram_alloc (    n )
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_histogram_alloc (  $n) #} )          ;; gsl_histogram * -> gptr
)


(de gsl_histogram_calloc (    n )
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_histogram_calloc (  $n) #} )          ;; gsl_histogram * -> gptr
)

(de gsl_histogram_calloc_uniform (    n  xmin  xmax )
    ((-int-) n)                     ;; size_t -> int
    ((-double-) xmin) 
    ((-double-) xmax) 
    (gptr #{ gsl_histogram_calloc_uniform (  $n ,$xmin ,$xmax) #} )          ;; gsl_histogram * -> gptr
)

(de gsl_histogram_free (    h )
    ((-gptr- "gsl_histogram *") h) 
    #{ gsl_histogram_free (  $h) #} 
    ()
)

(de gsl_histogram_increment (    h  x )
    ((-gptr- "gsl_histogram *") h) 
    ((-double-) x) 
    (int #{ gsl_histogram_increment (  $h ,$x) #} )
)

(de gsl_histogram_accumulate (    h  x  weight )
    ((-gptr- "gsl_histogram *") h) 
    ((-double-) x) 
    ((-double-) weight) 
    (int #{ gsl_histogram_accumulate (  $h ,$x ,$weight) #} )
)

(de gsl_histogram_find (    h  x  i )
    ((-gptr- "const gsl_histogram *") h) 
    ((-double-) x) 
    ((-gptr- "size_t *") i) 
    (int #{ gsl_histogram_find (  $h ,$x ,$i) #} )
)


(de gsl_histogram_get (    h  i )
    ((-gptr- "const gsl_histogram *") h) 
    ((-int-) i)                     ;; size_t -> int
    (double #{ gsl_histogram_get (  $h ,$i) #} )
)

(de gsl_histogram_get_range (    h  i  lower  upper )
    ((-gptr- "const gsl_histogram *") h) 
    ((-int-) i)                     ;; size_t -> int
    ((-gptr- "double *") lower) 
    ((-gptr- "double *") upper) 
    (int #{ gsl_histogram_get_range (  $h ,$i ,$lower ,$upper) #} )
)

				     
(de gsl_histogram_max (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (double #{ gsl_histogram_max (  $h) #} )
)

(de gsl_histogram_min (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (double #{ gsl_histogram_min (  $h) #} )
)

(de gsl_histogram_bins (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (int #{ gsl_histogram_bins (  $h) #} )                ;; size_t -> int
)


(de gsl_histogram_reset (    h )
    ((-gptr- "gsl_histogram *") h) 
    #{ gsl_histogram_reset (  $h) #} 
    ()
)


(de gsl_histogram_calloc_range (    n  range )
    ((-int-) n)                     ;; size_t -> int
    ((-gptr- "double *") range) 
    (gptr #{ gsl_histogram_calloc_range(  $n ,$range) #} )          ;; gsl_histogram * -> gptr
)


(de gsl_histogram_set_ranges (    h  range  size )
    ((-gptr- "gsl_histogram *") h) 
    ((-gptr- "const double *") range) 
    ((-int-) size)                     ;; size_t -> int
    (int #{ gsl_histogram_set_ranges (  $h ,$range ,$size) #} )
)

(de gsl_histogram_set_ranges_uniform (    h  xmin  xmax )
    ((-gptr- "gsl_histogram *") h) 
    ((-double-) xmin) 
    ((-double-) xmax) 
    (int #{ gsl_histogram_set_ranges_uniform (  $h ,$xmin ,$xmax) #} )
)




(de gsl_histogram_memcpy (    dest  source )
    ((-gptr- "gsl_histogram *") dest) 
    ((-gptr- "const gsl_histogram *") source) 
    (int #{ gsl_histogram_memcpy(  $dest ,$source) #} )
)


(de gsl_histogram_clone (    source )
    ((-gptr- "const gsl_histogram *") source) 
    (gptr #{ gsl_histogram_clone(  $source) #} )          ;; gsl_histogram * -> gptr
)


(de gsl_histogram_max_val (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (double #{ gsl_histogram_max_val (  $h) #} )
)


(de gsl_histogram_max_bin (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (int #{ gsl_histogram_max_bin (  $h) #} )                ;; size_t -> int
)


(de gsl_histogram_min_val (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (double #{ gsl_histogram_min_val (  $h) #} )
)


(de gsl_histogram_min_bin (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (int #{ gsl_histogram_min_bin (  $h) #} )                ;; size_t -> int
)


(de gsl_histogram_equal_bins_p (     h1   h2 )
    ((-gptr- "const gsl_histogram *") h1) 
    ((-gptr- "const gsl_histogram *") h2) 
    (int #{ gsl_histogram_equal_bins_p(  $h1 ,$h2) #} )
)


(de gsl_histogram_add (     h1   h2 )
    ((-gptr- "gsl_histogram *") h1) 
    ((-gptr- "const gsl_histogram *") h2) 
    (int #{ gsl_histogram_add(  $h1 ,$h2) #} )
)


(de gsl_histogram_sub (     h1   h2 )
    ((-gptr- "gsl_histogram *") h1) 
    ((-gptr- "const gsl_histogram *") h2) 
    (int #{ gsl_histogram_sub(  $h1 ,$h2) #} )
)


(de gsl_histogram_mul (     h1   h2 )
    ((-gptr- "gsl_histogram *") h1) 
    ((-gptr- "const gsl_histogram *") h2) 
    (int #{ gsl_histogram_mul(  $h1 ,$h2) #} )
)

 
(de gsl_histogram_div (     h1   h2 )
    ((-gptr- "gsl_histogram *") h1) 
    ((-gptr- "const gsl_histogram *") h2) 
    (int #{ gsl_histogram_div(  $h1 ,$h2) #} )
)


(de gsl_histogram_scale (     h  scale )
    ((-gptr- "gsl_histogram *") h) 
    ((-double-) scale) 
    (int #{ gsl_histogram_scale(  $h ,$scale) #} )
)


(de gsl_histogram_shift (    h  shift )
    ((-gptr- "gsl_histogram *") h) 
    ((-double-) shift) 
    (int #{ gsl_histogram_shift (  $h ,$shift) #} )
)



(de gsl_histogram_sigma (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (double #{ gsl_histogram_sigma (  $h) #} )
)


(de gsl_histogram_mean (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (double #{ gsl_histogram_mean (  $h) #} )
)


(if (> gsl-libversion 1.0)
    (de gsl_histogram_sum (    h )
      ((-gptr- "const gsl_histogram *") h) 
      (double #{ gsl_histogram_sum (  $h) #} )
      )
  (de gsl_histogram_sum (    h )
    ((-gptr- "const gsl_histogram *") h) 
    (error "not available in this version of GSL") ()))



(de gsl_histogram_fwrite (    stream  h )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "const gsl_histogram *") h) 
    (int #{ gsl_histogram_fwrite (  $stream ,$h)  #} )
)

(de gsl_histogram_fread (    stream  h )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "gsl_histogram *") h) 
    (int #{ gsl_histogram_fread (  $stream ,$h) #} )
)

(de gsl_histogram_fprintf (    stream  h  range_format  bin_format )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "const gsl_histogram *") h) 
    ((-gptr- "const char *") range_format) 
    ((-gptr- "const char *") bin_format) 
    (int #{ gsl_histogram_fprintf (  $stream ,$h ,$range_format ,$bin_format) #} )
)

(de gsl_histogram_fscanf (    stream  h )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "gsl_histogram *") h) 
    (int #{ gsl_histogram_fscanf (  $stream ,$h) #} )
)


(de gsl_histogram_pdf_alloc (    n )
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_histogram_pdf_alloc (  $n) #} )          ;; gsl_histogram_pdf * -> gptr
)

(de gsl_histogram_pdf_init (    p  h )
    ((-gptr- "gsl_histogram_pdf *") p) 
    ((-gptr- "const gsl_histogram *") h) 
    (int #{ gsl_histogram_pdf_init (  $p ,$h) #} )
)

(de gsl_histogram_pdf_free (    p )
    ((-gptr- "gsl_histogram_pdf *") p) 
    #{ gsl_histogram_pdf_free (  $p) #} 
    ()
)

(de gsl_histogram_pdf_sample (    p  r )
    ((-gptr- "const gsl_histogram_pdf *") p) 
    ((-double-) r) 
    (double #{ gsl_histogram_pdf_sample (  $p ,$r) #} )
)



;;;;***********************************************************************************************
;;;;               gsl_histogram2d


(de gsl_histogram2d_alloc (    nx  ny )
    ((-int-) nx)                     ;; size_t -> int
    ((-int-) ny)                     ;; size_t -> int
    (gptr #{ gsl_histogram2d_alloc (  $nx ,$ny) #} )          ;; gsl_histogram2d * -> gptr
)

(de gsl_histogram2d_calloc (    nx  ny )
    ((-int-) nx)                     ;; size_t -> int
    ((-int-) ny)                     ;; size_t -> int
    (gptr #{ gsl_histogram2d_calloc (  $nx ,$ny) #} )          ;; gsl_histogram2d * -> gptr
)

(de gsl_histogram2d_calloc_uniform (    nx  ny  xmin  xmax  ymin  ymax )
    ((-int-) nx)                     ;; size_t -> int
    ((-int-) ny)                     ;; size_t -> int
    ((-double-) xmin) 
    ((-double-) xmax) 
    ((-double-) ymin) 
    ((-double-) ymax) 
    (gptr #{ gsl_histogram2d_calloc_uniform (  $nx ,$ny ,$xmin ,$xmax ,$ymin ,$ymax) #} )          ;; gsl_histogram2d * -> gptr
)


(de gsl_histogram2d_free (    h )
    ((-gptr- "gsl_histogram2d *") h) 
    #{ gsl_histogram2d_free (  $h) #} 
    ()
)


(de gsl_histogram2d_increment (    h  x  y )
    ((-gptr- "gsl_histogram2d *") h) 
    ((-double-) x) 
    ((-double-) y) 
    (int #{ gsl_histogram2d_increment (  $h ,$x ,$y) #} )
)

(de gsl_histogram2d_accumulate (    h  x  y  weight )
    ((-gptr- "gsl_histogram2d *") h) 
    ((-double-) x) 
    ((-double-) y) 
    ((-double-) weight) 
    (int #{ gsl_histogram2d_accumulate (  $h ,$x ,$y ,$weight) #} )
)

(de gsl_histogram2d_find (    h  x  y  i  j )
    ((-gptr- "const gsl_histogram2d *") h) 
    ((-double-) x) 
    ((-double-) y) 
    ((-gptr- "size_t *") i) 
    ((-gptr- "size_t *") j) 
    (int #{ gsl_histogram2d_find (  $h ,$x ,$y ,$i ,$j) #} )
)


(de gsl_histogram2d_get (    h  i  j )
    ((-gptr- "const gsl_histogram2d *") h) 
    ((-int-) i)                     ;; size_t -> int
    ((-int-) j)                     ;; size_t -> int
    (double #{ gsl_histogram2d_get (  $h ,$i ,$j) #} )
)

(de gsl_histogram2d_get_xrange (    h  i  xlower  xupper )
    ((-gptr- "const gsl_histogram2d *") h) 
    ((-int-) i)                     ;; size_t -> int
    ((-gptr- "double *") xlower) 
    ((-gptr- "double *") xupper) 
    (int #{ gsl_histogram2d_get_xrange (  $h ,$i ,$xlower ,$xupper) #} )
)

(de gsl_histogram2d_get_yrange (    h  j  ylower  yupper )
    ((-gptr- "const gsl_histogram2d *") h) 
    ((-int-) j)                     ;; size_t -> int
    ((-gptr- "double *") ylower) 
    ((-gptr- "double *") yupper) 
    (int #{ gsl_histogram2d_get_yrange (  $h ,$j ,$ylower ,$yupper) #} )
)


				     
(de gsl_histogram2d_xmax (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (double #{ gsl_histogram2d_xmax (  $h) #} )
)

(de gsl_histogram2d_xmin (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (double #{ gsl_histogram2d_xmin (  $h) #} )
)

(de gsl_histogram2d_nx (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (int #{ gsl_histogram2d_nx (  $h) #} )                ;; size_t -> int
)


(de gsl_histogram2d_ymax (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (double #{ gsl_histogram2d_ymax (  $h) #} )
)

(de gsl_histogram2d_ymin (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (double #{ gsl_histogram2d_ymin (  $h) #} )
)

(de gsl_histogram2d_ny (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (int #{ gsl_histogram2d_ny (  $h) #} )                ;; size_t -> int
)


(de gsl_histogram2d_reset (    h )
    ((-gptr- "gsl_histogram2d *") h) 
    #{ gsl_histogram2d_reset (  $h) #} 
    ()
)


(de gsl_histogram2d_calloc_range (    nx  ny   xrange   yrange )
    ((-int-) nx)                     ;; size_t -> int
    ((-int-) ny)                     ;; size_t -> int
    ((-gptr- "double *") xrange) 
    ((-gptr- "double *") yrange) 
    (gptr #{ gsl_histogram2d_calloc_range(  $nx ,$ny ,$xrange ,$yrange) #} )          ;; gsl_histogram2d * -> gptr
)


(de gsl_histogram2d_set_ranges_uniform (    h  xmin  xmax  ymin  ymax )
    ((-gptr- "gsl_histogram2d *") h) 
    ((-double-) xmin) 
    ((-double-) xmax) 
    ((-double-) ymin) 
    ((-double-) ymax) 
    (int #{ gsl_histogram2d_set_ranges_uniform (  $h ,$xmin ,$xmax ,$ymin ,$ymax) #} )
)


(de gsl_histogram2d_set_ranges (    h  xrange  xsize  yrange  ysize )
    ((-gptr- "gsl_histogram2d *") h) 
    ((-gptr- "const double *") xrange) 
    ((-int-) xsize)                     ;; size_t -> int
    ((-gptr- "const double *") yrange) 
    ((-int-) ysize)                     ;; size_t -> int
    (int #{ gsl_histogram2d_set_ranges (  $h ,$xrange ,$xsize ,$yrange ,$ysize) #} )
)


(de gsl_histogram2d_memcpy (     dest   source )
    ((-gptr- "gsl_histogram2d *") dest) 
    ((-gptr- "const gsl_histogram2d *") source) 
    (int #{ gsl_histogram2d_memcpy(  $dest ,$source) #} )
)


(de gsl_histogram2d_clone (    source )
    ((-gptr- "const gsl_histogram2d *") source) 
    (gptr #{ gsl_histogram2d_clone(  $source) #} )          ;; gsl_histogram2d * -> gptr
)


(de gsl_histogram2d_max_val (     h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (double #{ gsl_histogram2d_max_val(  $h) #} )
)


(de gsl_histogram2d_max_bin (     h   i   j )
    ((-gptr- "const gsl_histogram2d *") h) 
    ((-gptr- "size_t *") i) 
    ((-gptr- "size_t *") j) 
    #{ gsl_histogram2d_max_bin (  $h ,$i ,$j) #} 
    ()
)


(de gsl_histogram2d_min_val (     h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (double #{ gsl_histogram2d_min_val(  $h) #} )
)


(de gsl_histogram2d_min_bin (     h   i   j )
    ((-gptr- "const gsl_histogram2d *") h) 
    ((-gptr- "size_t *") i) 
    ((-gptr- "size_t *") j) 
    #{ gsl_histogram2d_min_bin (  $h ,$i ,$j) #} 
    ()
)


(if (> gsl-libversion 1.0)
    (de gsl_histogram2d_xmean (    h )
      ((-gptr- "const gsl_histogram2d *") h) 
      (double #{ gsl_histogram2d_xmean (  $h) #} )
      )
  (de gsl_histogram2d_xmean (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (error "not available in this version of GSL") ()))




(if (> gsl-libversion 1.0)
    (progn
      (de gsl_histogram2d_ymean (    h )
	((-gptr- "const gsl_histogram2d *") h) 
	(double #{ gsl_histogram2d_ymean (  $h) #} ))
      (de gsl_histogram2d_xsigma (    h )
	((-gptr- "const gsl_histogram2d *") h) 
	(double #{ gsl_histogram2d_xsigma (  $h) #} ))
      (de gsl_histogram2d_ysigma (    h )
	((-gptr- "const gsl_histogram2d *") h) 
	(double #{ gsl_histogram2d_ysigma (  $h) #} ))
      (de gsl_histogram2d_cov (    h )
	((-gptr- "const gsl_histogram2d *") h) 
	(double #{ gsl_histogram2d_cov (  $h) #} ))
      (de gsl_histogram2d_sum (     h )
	((-gptr- "const gsl_histogram2d *") h) 
	(double #{ gsl_histogram2d_sum (  $h) #} )))
  (de gsl_histogram2d_ymean (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (error "not available in this version of GSL") ())
  (de gsl_histogram2d_xsigma (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (error "not available in this version of GSL") ())
  (de gsl_histogram2d_ysigma (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (error "not available in this version of GSL") ())
  (de gsl_histogram2d_cov (    h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (error "not available in this version of GSL") ())
  (de gsl_histogram2d_sum (     h )
    ((-gptr- "const gsl_histogram2d *") h) 
    (error "not available in this version of GSL") ()))






(de gsl_histogram2d_equal_bins_p (     h1   h2 )
    ((-gptr- "const gsl_histogram2d *") h1) 
    ((-gptr- "const gsl_histogram2d *") h2) 
    (int #{ gsl_histogram2d_equal_bins_p(  $h1 ,$h2)  #} )
)


(de gsl_histogram2d_add (     h1   h2 )
    ((-gptr- "gsl_histogram2d *") h1) 
    ((-gptr- "const gsl_histogram2d *") h2) 
    (int #{ gsl_histogram2d_add(  $h1 ,$h2) #} )
)


(de gsl_histogram2d_sub (     h1   h2 )
    ((-gptr- "gsl_histogram2d *") h1) 
    ((-gptr- "const gsl_histogram2d *") h2) 
    (int #{ gsl_histogram2d_sub(  $h1 ,$h2) #} )
)


(de gsl_histogram2d_mul (     h1   h2 )
    ((-gptr- "gsl_histogram2d *") h1) 
    ((-gptr- "const gsl_histogram2d *") h2) 
    (int #{ gsl_histogram2d_mul(  $h1 ,$h2) #} )
)


(de gsl_histogram2d_div (     h1   h2 )
    ((-gptr- "gsl_histogram2d *") h1) 
    ((-gptr- "const gsl_histogram2d *") h2) 
    (int #{ gsl_histogram2d_div(  $h1 ,$h2) #} )
)


(de gsl_histogram2d_scale (     h  scale )
    ((-gptr- "gsl_histogram2d *") h) 
    ((-double-) scale) 
    (int #{ gsl_histogram2d_scale(  $h ,$scale) #} )
)


(de gsl_histogram2d_shift (     h  shift )
    ((-gptr- "gsl_histogram2d *") h) 
    ((-double-) shift) 
    (int #{ gsl_histogram2d_shift(  $h ,$shift) #} )
)


(de gsl_histogram2d_fwrite (    stream  h )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "const gsl_histogram2d *") h) 
    (int #{ gsl_histogram2d_fwrite (  $stream ,$h)  #} )
)

(de gsl_histogram2d_fread (    stream  h )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "gsl_histogram2d *") h) 
    (int #{ gsl_histogram2d_fread (  $stream ,$h) #} )
)

(de gsl_histogram2d_fprintf (    stream  h  range_format  bin_format )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "const gsl_histogram2d *") h) 
    ((-gptr- "const char *") range_format) 
    ((-gptr- "const char *") bin_format) 
    (int #{ gsl_histogram2d_fprintf (  $stream ,$h ,$range_format ,$bin_format) #} )
)

(de gsl_histogram2d_fscanf (    stream  h )
    ((-gptr- "FILE *") stream) 
    ((-gptr- "gsl_histogram2d *") h) 
    (int #{ gsl_histogram2d_fscanf (  $stream ,$h) #} )
)


(de gsl_histogram2d_pdf_alloc (    nx  ny )
    ((-int-) nx)                     ;; size_t -> int
    ((-int-) ny)                     ;; size_t -> int
    (gptr #{ gsl_histogram2d_pdf_alloc (  $nx ,$ny) #} )          ;; gsl_histogram2d_pdf * -> gptr
)

(de gsl_histogram2d_pdf_init (    p  h )
    ((-gptr- "gsl_histogram2d_pdf *") p) 
    ((-gptr- "const gsl_histogram2d *") h) 
    (int #{ gsl_histogram2d_pdf_init (  $p ,$h) #} )
)

(de gsl_histogram2d_pdf_free (    p )
    ((-gptr- "gsl_histogram2d_pdf *") p) 
    #{ gsl_histogram2d_pdf_free (  $p) #} 
    ()
)

(de gsl_histogram2d_pdf_sample (    p  r1  r2  x  y )
    ((-gptr- "const gsl_histogram2d_pdf *") p) 
    ((-double-) r1) 
    ((-double-) r2) 
    ((-gptr- "double *") x) 
    ((-gptr- "double *") y) 
    (int #{ gsl_histogram2d_pdf_sample (  $p ,$r1 ,$r2 ,$x ,$y) #} )
)

;; ********************************************************

(dhc-make ()
  dummy_histogram
  gsl_histogram_alloc
  gsl_histogram_calloc
  gsl_histogram_calloc_uniform
  gsl_histogram_free
  gsl_histogram_increment
  gsl_histogram_accumulate
  gsl_histogram_find
  gsl_histogram_get
  gsl_histogram_get_range
  gsl_histogram_max
  gsl_histogram_min
  gsl_histogram_bins
  gsl_histogram_reset
  gsl_histogram_calloc_range
  gsl_histogram_set_ranges
  gsl_histogram_set_ranges_uniform
  gsl_histogram_memcpy
  gsl_histogram_clone
  gsl_histogram_max_val
  gsl_histogram_max_bin
  gsl_histogram_min_val
  gsl_histogram_min_bin
  gsl_histogram_equal_bins_p
  gsl_histogram_add
  gsl_histogram_sub
  gsl_histogram_mul
  gsl_histogram_div
  gsl_histogram_scale
  gsl_histogram_shift
  gsl_histogram_sigma
  gsl_histogram_mean
  gsl_histogram_sum
  gsl_histogram_fwrite
  gsl_histogram_fread
  gsl_histogram_fprintf
  gsl_histogram_fscanf
  gsl_histogram_pdf_alloc
  gsl_histogram_pdf_init
  gsl_histogram_pdf_free
  gsl_histogram_pdf_sample
  gsl_histogram2d_alloc
  gsl_histogram2d_calloc
  gsl_histogram2d_calloc_uniform
  gsl_histogram2d_free
  gsl_histogram2d_increment
  gsl_histogram2d_accumulate
  gsl_histogram2d_find
  gsl_histogram2d_get
  gsl_histogram2d_get_xrange
  gsl_histogram2d_get_yrange
  gsl_histogram2d_xmax
  gsl_histogram2d_xmin
  gsl_histogram2d_nx
  gsl_histogram2d_ymax
  gsl_histogram2d_ymin
  gsl_histogram2d_ny
  gsl_histogram2d_reset
  gsl_histogram2d_calloc_range
  gsl_histogram2d_set_ranges_uniform
  gsl_histogram2d_set_ranges
  gsl_histogram2d_memcpy
  gsl_histogram2d_clone
  gsl_histogram2d_max_val
  gsl_histogram2d_max_bin
  gsl_histogram2d_min_val
  gsl_histogram2d_min_bin
  gsl_histogram2d_xmean
  gsl_histogram2d_ymean
  gsl_histogram2d_xsigma
  gsl_histogram2d_ysigma
  gsl_histogram2d_cov
  gsl_histogram2d_sum
  gsl_histogram2d_equal_bins_p
  gsl_histogram2d_add
  gsl_histogram2d_sub
  gsl_histogram2d_mul
  gsl_histogram2d_div
  gsl_histogram2d_scale
  gsl_histogram2d_shift
  gsl_histogram2d_fwrite
  gsl_histogram2d_fread
  gsl_histogram2d_fprintf
  gsl_histogram2d_fscanf
  gsl_histogram2d_pdf_alloc
  gsl_histogram2d_pdf_init
  gsl_histogram2d_pdf_free
  gsl_histogram2d_pdf_sample
)
