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



#? *** roots

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

#? * (dummy_roots)
#? * (gsl_root_fsolver_alloc <p>)
#? * (gsl_root_fsolver_free <s>)
#? * (gsl_root_fsolver_set <s> <f> <x_lower> <x_upper>)
#? * (gsl_root_fsolver_iterate <s>)
#? * (gsl_root_fsolver_name <s>)
#? * (gsl_root_fsolver_root <s>)
#? * (gsl_root_fsolver_x_lower <s>)
#? * (gsl_root_fsolver_x_upper <s>)
#? * (gsl_root_fdfsolver_alloc <p>)
#? * (gsl_root_fdfsolver_set <s> <fdf> <root>)
#? * (gsl_root_fdfsolver_iterate <s>)
#? * (gsl_root_fdfsolver_free <s>)
#? * (gsl_root_fdfsolver_name <s>)
#? * (gsl_root_fdfsolver_root <s>)
#? * (gsl_root_test_interval <x_lower> <x_upper> <epsabs> <epsrel>)
#? * (gsl_root_test_residual <f> <epsabs>)
#? * (gsl_root_test_delta <x1> <x0> <epsabs> <epsrel>)

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



(de gsl_root_fsolver_alloc (    p )
    ((-gptr- "const gsl_root_fsolver_type *") p) 
    (gptr #{ gsl_root_fsolver_alloc (  $p) #} )          ;; gsl_root_fsolver * -> gptr
)

(de gsl_root_fsolver_free (    s )
    ((-gptr- "gsl_root_fsolver *") s) 
    #{ gsl_root_fsolver_free (  $s) #} 
    ()
)


(de gsl_root_fsolver_set (    s  f  x_lower  x_upper )
    ((-gptr- "gsl_root_fsolver *") s) 
    ((-gptr- "gsl_function *") f) 
    ((-double-) x_lower) 
    ((-double-) x_upper) 
    (int #{ gsl_root_fsolver_set (  $s ,$f ,$x_lower ,$x_upper) #} )
)


(de gsl_root_fsolver_iterate (    s )
    ((-gptr- "gsl_root_fsolver *") s) 
    (int #{ gsl_root_fsolver_iterate (  $s) #} )
)


(de gsl_root_fsolver_name (    s )
    ((-gptr- "const gsl_root_fsolver *") s) 
    (gptr #{ gsl_root_fsolver_name (  $s) #} )          ;; const char * -> gptr
)

(de gsl_root_fsolver_root (    s )
    ((-gptr- "const gsl_root_fsolver *") s) 
    (double #{ gsl_root_fsolver_root (  $s) #} )
)

(de gsl_root_fsolver_x_lower (    s )
    ((-gptr- "const gsl_root_fsolver *") s) 
    (double #{ gsl_root_fsolver_x_lower (  $s) #} )
)

(de gsl_root_fsolver_x_upper (    s )
    ((-gptr- "const gsl_root_fsolver *") s) 
    (double #{ gsl_root_fsolver_x_upper (  $s) #} )
)



(de gsl_root_fdfsolver_alloc (    p )
    ((-gptr- "const gsl_root_fdfsolver_type *") p) 
    (gptr #{ gsl_root_fdfsolver_alloc (  $p) #} )          ;; gsl_root_fdfsolver * -> gptr
)


(de gsl_root_fdfsolver_set (    s  fdf  root )
    ((-gptr- "gsl_root_fdfsolver *") s) 
    ((-gptr- "gsl_function_fdf *") fdf) 
    ((-double-) root) 
    (int #{ gsl_root_fdfsolver_set (  $s ,$fdf ,$root) #} )
)


(de gsl_root_fdfsolver_iterate (    s )
    ((-gptr- "gsl_root_fdfsolver *") s) 
    (int #{ gsl_root_fdfsolver_iterate (  $s) #} )
)


(de gsl_root_fdfsolver_free (    s )
    ((-gptr- "gsl_root_fdfsolver *") s) 
    #{ gsl_root_fdfsolver_free (  $s) #} 
    ()
)


(de gsl_root_fdfsolver_name (    s )
    ((-gptr- "const gsl_root_fdfsolver *") s) 
    (gptr #{ gsl_root_fdfsolver_name (  $s) #} )          ;; const char * -> gptr
)

(de gsl_root_fdfsolver_root (    s )
    ((-gptr- "const gsl_root_fdfsolver *") s) 
    (double #{ gsl_root_fdfsolver_root (  $s) #} )
)


(de gsl_root_test_interval (    x_lower  x_upper  epsabs  epsrel )
    ((-double-) x_lower) 
    ((-double-) x_upper) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    (int #{ gsl_root_test_interval (  $x_lower ,$x_upper ,$epsabs ,$epsrel) #} )
)


(de gsl_root_test_residual (    f  epsabs )
    ((-double-) f) 
    ((-double-) epsabs) 
    (int #{ gsl_root_test_residual (  $f ,$epsabs) #} )
)


(de gsl_root_test_delta (    x1  x0  epsabs  epsrel )
    ((-double-) x1) 
    ((-double-) x0) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    (int #{ gsl_root_test_delta (  $x1 ,$x0 ,$epsabs ,$epsrel) #} )
)


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

(dhc-make ()
  dummy_roots
  gsl_root_fsolver_alloc
  gsl_root_fsolver_free
  gsl_root_fsolver_set
  gsl_root_fsolver_iterate
  gsl_root_fsolver_name
  gsl_root_fsolver_root
  gsl_root_fsolver_x_lower
  gsl_root_fsolver_x_upper
  gsl_root_fdfsolver_alloc
  gsl_root_fdfsolver_set
  gsl_root_fdfsolver_iterate
  gsl_root_fdfsolver_free
  gsl_root_fdfsolver_name
  gsl_root_fdfsolver_root
  gsl_root_test_interval
  gsl_root_test_residual
  gsl_root_test_delta
)
