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



#? *** multimin

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

#? * (dummy_multimin)
#? * (gsl_multimin_diff <f> <x> <g>)
#? * (gsl_multimin_fdfminimizer_alloc <p> <n>)
#? * (gsl_multimin_fdfminimizer_set <s> <fdf> <x> <step_size> <tol>)
#? * (gsl_multimin_fdfminimizer_free <s>)
#? * (gsl_multimin_fdfminimizer_name <s>)
#? * (gsl_multimin_fdfminimizer_iterate <s>)
#? * (gsl_multimin_fdfminimizer_restart <s>)
#? * (gsl_multimin_test_gradient <g> <epsabs>)
#? * (gsl_multimin_fdfminimizer_x <s>)
#? * (gsl_multimin_fdfminimizer_dx <s>)
#? * (gsl_multimin_fdfminimizer_gradient <s>)
#? * (gsl_multimin_fdfminimizer_minimum <s>)

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


(de gsl_multimin_diff (    f  x  g )
    ((-gptr- "const gsl_multimin_function *") f) 
    ((-gptr- "const gsl_vector *") x) 
    ((-gptr- "gsl_vector *") g) 
    (int #{ gsl_multimin_diff (  $f ,$x ,$g) #} )
)




(de gsl_multimin_fdfminimizer_alloc (     p  n )
    ((-gptr- "const gsl_multimin_fdfminimizer_type *") p) 
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_multimin_fdfminimizer_alloc(  $p ,$n) #} )          ;; gsl_multimin_fdfminimizer * -> gptr
)


(de gsl_multimin_fdfminimizer_set (    s   fdf  x  step_size  tol )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    ((-gptr- "gsl_multimin_function_fdf *") fdf) 
    ((-gptr- "const gsl_vector *") x) 
    ((-double-) step_size) 
    ((-double-) tol) 
    (int #{ gsl_multimin_fdfminimizer_set (  $s ,$fdf ,$x ,$step_size ,$tol) #} )
)


(de gsl_multimin_fdfminimizer_free (     s )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    #{ gsl_multimin_fdfminimizer_free(  $s) #} 
    ()
)


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


(de gsl_multimin_fdfminimizer_iterate (     s )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    (int #{ gsl_multimin_fdfminimizer_iterate(  $s) #} )
)


(de gsl_multimin_fdfminimizer_restart (     s )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    (int #{ gsl_multimin_fdfminimizer_restart(  $s) #} )
)


(de gsl_multimin_test_gradient (    g  epsabs )
    ((-gptr- "const gsl_vector *") g) 
    ((-double-) epsabs) 
    (int #{ gsl_multimin_test_gradient(  $g ,$epsabs) #} )
)


(de gsl_multimin_fdfminimizer_x (    s )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    (gptr #{ gsl_multimin_fdfminimizer_x (  $s) #} )          ;; gsl_vector * -> gptr
)


(de gsl_multimin_fdfminimizer_dx (    s )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    (gptr #{ gsl_multimin_fdfminimizer_dx (  $s) #} )          ;; gsl_vector * -> gptr
)


(de gsl_multimin_fdfminimizer_gradient (    s )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    (gptr #{ gsl_multimin_fdfminimizer_gradient (  $s) #} )          ;; gsl_vector * -> gptr
)


(de gsl_multimin_fdfminimizer_minimum (    s )
    ((-gptr- "gsl_multimin_fdfminimizer *") s) 
    (double #{ gsl_multimin_fdfminimizer_minimum (  $s) #} )
)

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

(dhc-make ()
  dummy_multimin
  gsl_multimin_diff
  gsl_multimin_fdfminimizer_alloc
  gsl_multimin_fdfminimizer_set
  gsl_multimin_fdfminimizer_free
  gsl_multimin_fdfminimizer_name
  gsl_multimin_fdfminimizer_iterate
  gsl_multimin_fdfminimizer_restart
  gsl_multimin_test_gradient
  gsl_multimin_fdfminimizer_x
  gsl_multimin_fdfminimizer_dx
  gsl_multimin_fdfminimizer_gradient
  gsl_multimin_fdfminimizer_minimum
)
