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



#? *** ode-initval

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

#? * (dummy_ode-initval)
#? * (gsl_odeiv_step_alloc <p> <dim>)
#? * (gsl_odeiv_step_reset <s>)
#? * (gsl_odeiv_step_free <s>)
#? * (gsl_odeiv_step_name <s>)
#? * (gsl_odeiv_step_order <s>)
#? * (gsl_odeiv_step_apply <s> <t> <h> <y> <yerr> <dydt_in> <dydt_out> <dydt>)
#? * (gsl_odeiv_control_alloc <p>)
#? * (gsl_odeiv_control_init <c> <eps_abs> <eps_rel> <a_y> <a_dydt>)
#? * (gsl_odeiv_control_free <c>)
#? * (gsl_odeiv_control_hadjust <c> <s> <y0> <yerr> <dydt> <h>)
#? * (gsl_odeiv_control_name <c>)
#? * (gsl_odeiv_control_standard_new <eps_abs> <eps_rel> <a_y> <a_dydt>)
#? * (gsl_odeiv_control_y_new <eps_abs> <eps_rel>)
#? * (gsl_odeiv_control_yp_new <eps_abs> <eps_rel>)
#? * (gsl_odeiv_evolve_alloc <dim>)
#? * (gsl_odeiv_evolve_apply <s> <con> <step> <dydt> <p> <t1> <h> <y>)
#? * (gsl_odeiv_evolve_reset <s>)
#? * (gsl_odeiv_evolve_free <s>)

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



(de gsl_odeiv_step_alloc (    p  dim )
    ((-gptr- "const gsl_odeiv_step_type *") p) 
    ((-int-) dim)                     ;; size_t -> int
    (gptr #{ gsl_odeiv_step_alloc(  $p ,$dim) #} )          ;; gsl_odeiv_step * -> gptr
)

(de gsl_odeiv_step_reset (    s )
    ((-gptr- "gsl_odeiv_step *") s) 
    (int  #{ gsl_odeiv_step_reset(  $s) #} )
)

(de gsl_odeiv_step_free (    s )
    ((-gptr- "gsl_odeiv_step *") s) 
    #{ gsl_odeiv_step_free(  $s) #} 
    ()
)



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

(de gsl_odeiv_step_order (    s )
    ((-gptr- "const gsl_odeiv_step *") s) 
    (int #{ gsl_odeiv_step_order(  $s) #} )          ;; unsigned  -> signed
)


(de gsl_odeiv_step_apply (  s     t  h  y  yerr  dydt_in  dydt_out  dydt )
    ((-gptr- "gsl_odeiv_step *") s) 
    ((-double-) t) 
    ((-double-) h) 
    ((-gptr- "double *") y) 
    ((-gptr- "double *") yerr) 
    ((-gptr- "const double *") dydt_in) 
    ((-gptr- "double *") dydt_out) 
    ((-gptr- "const gsl_odeiv_system *") dydt) 
    (int  #{ gsl_odeiv_step_apply(  $s ,$t ,$h ,$y ,$yerr ,$dydt_in ,$dydt_out ,$dydt) #} )
)


(de gsl_odeiv_control_alloc (  p )
    ((-gptr- "const gsl_odeiv_control_type *") p) 
    (gptr #{ gsl_odeiv_control_alloc(  $p) #} )          ;; gsl_odeiv_control * -> gptr
)

(de gsl_odeiv_control_init (    c  eps_abs  eps_rel  a_y  a_dydt )
    ((-gptr- "gsl_odeiv_control *") c) 
    ((-double-) eps_abs) 
    ((-double-) eps_rel) 
    ((-double-) a_y) 
    ((-double-) a_dydt) 
    (int #{ gsl_odeiv_control_init(  $c ,$eps_abs ,$eps_rel ,$a_y ,$a_dydt) #} )
)

(de gsl_odeiv_control_free (    c )
    ((-gptr- "gsl_odeiv_control *") c) 
    #{ gsl_odeiv_control_free(  $c) #} 
    ()
)

(de gsl_odeiv_control_hadjust (    c  s  y0  yerr  dydt  h )
    ((-gptr- "gsl_odeiv_control *") c) 
    ((-gptr- "gsl_odeiv_step *") s) 
    ((-gptr- "const double *") y0) 
    ((-gptr- "const double *") yerr) 
    ((-gptr- "const double *") dydt) 
    ((-gptr- "double *") h) 
    (int #{ gsl_odeiv_control_hadjust (  $c ,$s ,$y0 ,$yerr ,$dydt ,$h) #} )
)

(de gsl_odeiv_control_name (    c )
    ((-gptr- "const gsl_odeiv_control *") c) 
    (gptr #{ gsl_odeiv_control_name(  $c) #} )          ;; const char * -> gptr
)




(de gsl_odeiv_control_standard_new (    eps_abs  eps_rel  a_y  a_dydt )
    ((-double-) eps_abs) 
    ((-double-) eps_rel) 
    ((-double-) a_y) 
    ((-double-) a_dydt) 
    (gptr #{ gsl_odeiv_control_standard_new(  $eps_abs ,$eps_rel ,$a_y ,$a_dydt) #} )          ;; gsl_odeiv_control * -> gptr
)

(de gsl_odeiv_control_y_new (    eps_abs  eps_rel )
    ((-double-) eps_abs) 
    ((-double-) eps_rel) 
    (gptr #{ gsl_odeiv_control_y_new(  $eps_abs ,$eps_rel) #} )          ;; gsl_odeiv_control * -> gptr
)

(de gsl_odeiv_control_yp_new (    eps_abs  eps_rel )
    ((-double-) eps_abs) 
    ((-double-) eps_rel) 
    (gptr #{ gsl_odeiv_control_yp_new(  $eps_abs ,$eps_rel) #} )          ;; gsl_odeiv_control * -> gptr
)





(de gsl_odeiv_evolve_alloc (    dim )
    ((-int-) dim)                     ;; size_t -> int
    (gptr #{ gsl_odeiv_evolve_alloc(  $dim) #} )          ;; gsl_odeiv_evolve * -> gptr
)

(de gsl_odeiv_evolve_apply ( s      con  step  dydt  p  t1  h  y )
    ((-gptr- "gsl_odeiv_evolve *") s) 
    ((-gptr- "gsl_odeiv_control *") con) 
    ((-gptr- "gsl_odeiv_step *") step) 
    ((-gptr- "const gsl_odeiv_system *") dydt) 
    ((-gptr- "double *") p) 
    ((-double-) t1) 
    ((-gptr- "double *") h) 
    ((-gptr- "double *") y) 
    (int #{ gsl_odeiv_evolve_apply(  $s ,$con ,$step ,$dydt ,$p ,$t1 ,$h ,$y) #} )
)

(de gsl_odeiv_evolve_reset (  s  )
    ((-gptr- "gsl_odeiv_evolve  *") s) 
    (int #{ gsl_odeiv_evolve_reset( $s) #} )
)

(de gsl_odeiv_evolve_free (  s )
    ((-gptr- "gsl_odeiv_evolve  *") s) 
    #{ gsl_odeiv_evolve_free( $s ) #} 
    ()
)

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

(dhc-make ()
  dummy_ode-initval
  gsl_odeiv_step_alloc
  gsl_odeiv_step_reset
  gsl_odeiv_step_free
  gsl_odeiv_step_name
  gsl_odeiv_step_order
  gsl_odeiv_step_apply
  gsl_odeiv_control_alloc
  gsl_odeiv_control_init
  gsl_odeiv_control_free
  gsl_odeiv_control_hadjust
  gsl_odeiv_control_name
  gsl_odeiv_control_standard_new
  gsl_odeiv_control_y_new
  gsl_odeiv_control_yp_new
  gsl_odeiv_evolve_alloc
  gsl_odeiv_evolve_apply
  gsl_odeiv_evolve_reset
  gsl_odeiv_evolve_free
)
