;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 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")



#? *** rng

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

#? * (dummy_rng)
#? * (gsl_rng_types_setup)
#? * (gsl_rng_alloc <p>)
#? * (gsl_rng_memcpy <dest> <src>)
#? * (gsl_rng_clone <r>)
#? * (gsl_rng_free <r>)
#? * (gsl_rng_set <r> <seed>)
#? * (gsl_rng_max <r>)
#? * (gsl_rng_min <r>)
#? * (gsl_rng_name <r>)
#? * (gsl_rng_size <r>)
#? * (gsl_rng_state <r>)
#? * (gsl_rng_print_state <r>)
#? * (gsl_rng_env_setup)
#? * (gsl_rng_get <r>)
#? * (gsl_rng_uniform <r>)
#? * (gsl_rng_uniform_pos <r>)
#? * (gsl_rng_uniform_int <r> <n>)

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


(de gsl_rng_types_setup ( )
    (gptr #{ gsl_rng_types_setup( ) #} )          ;; const gsl_rng_type ** -> gptr
)


(de gsl_rng_alloc (    p )
    ((-gptr- "const gsl_rng_type *") p) 
    (gptr #{  gsl_rng_alloc (  $p ) #} )          ;; gsl_rng  * -> gptr
)

(de gsl_rng_memcpy (    dest  src )
    ((-gptr- "gsl_rng *") dest) 
    ((-gptr- "const gsl_rng *") src) 
    (int #{ gsl_rng_memcpy (  $dest ,$src) #} )
)

(de gsl_rng_clone (    r )
    ((-gptr- "const gsl_rng *") r) 
    (gptr #{  gsl_rng_clone (  $r) #} )          ;; gsl_rng  * -> gptr
)


(de gsl_rng_free (    r )
    ((-gptr- "gsl_rng *") r) 
    #{ gsl_rng_free (  $r) #} 
    ()
)


(de gsl_rng_set (    r  seed )
    ((-gptr- "const gsl_rng *") r) 
    ((-int-) seed)                               ;; unsigned long int -> int
    #{ gsl_rng_set (  $r ,$seed) #} 
    ()
)

(de gsl_rng_max (    r )
    ((-gptr- "const gsl_rng *") r) 
    (int #{ gsl_rng_max (  $r) #} )                 ;; unsigned long int -> int
)

(de gsl_rng_min (    r )
    ((-gptr- "const gsl_rng *") r) 
    (int #{ gsl_rng_min (  $r) #} )                 ;; unsigned long int -> int
)

(de gsl_rng_name (    r )
    ((-gptr- "const gsl_rng *") r) 
    (gptr #{ gsl_rng_name (  $r) #} )          ;; const char * -> gptr
)

(de gsl_rng_size (    r )
    ((-gptr- "const gsl_rng *") r) 
    (int #{ gsl_rng_size (  $r) #} )                ;; size_t -> int
)

(de gsl_rng_state (    r )
    ((-gptr- "const gsl_rng *") r) 
    (gptr #{ gsl_rng_state (  $r) #} )          ;; void * -> gptr
)


(de gsl_rng_print_state (    r )
    ((-gptr- "const gsl_rng *") r) 
    #{ gsl_rng_print_state (  $r) #} 
    ()
)


(de gsl_rng_env_setup (   )
    (gptr #{ gsl_rng_env_setup ( ) #} )          ;; const gsl_rng_type * -> gptr
)


(de gsl_rng_get (    r )
    ((-gptr- "const gsl_rng *") r) 
    (int #{ gsl_rng_get (  $r) #} )              ;; unsigned long int -> int
)

(de gsl_rng_uniform (    r )
    ((-gptr- "const gsl_rng *") r) 
    (double #{ gsl_rng_uniform (  $r) #} )
)

(de gsl_rng_uniform_pos (    r )
    ((-gptr- "const gsl_rng *") r) 
    (double #{ gsl_rng_uniform_pos (  $r) #} )
)

(de gsl_rng_uniform_int (    r  n )
    ((-gptr- "const gsl_rng *") r) 
    ((-int-) n)                                        ;; unsigned long int -> int
    (int #{ gsl_rng_uniform_int (  $r ,$n) #} )        ;; unsigned long int  -> int
)

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

(dhc-make ()
  dummy_rng
  gsl_rng_types_setup
  gsl_rng_alloc
  gsl_rng_memcpy
  gsl_rng_clone
  gsl_rng_free
  gsl_rng_set
  gsl_rng_max
  gsl_rng_min
  gsl_rng_name
  gsl_rng_size
  gsl_rng_state
  gsl_rng_print_state
  gsl_rng_env_setup
  gsl_rng_get
  gsl_rng_uniform
  gsl_rng_uniform_pos
  gsl_rng_uniform_int
)
