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



#? *** cheb

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

#? * (dummy_cheb)
#? * (gsl_cheb_alloc <order>)
#? * (gsl_cheb_free <cs>)
#? * (gsl_cheb_init <cs> <func> <a> <b>)
#? * (gsl_cheb_eval <cs> <x>)
#? * (gsl_cheb_eval_err <cs> <x> <result> <abserr>)
#? * (gsl_cheb_eval_n <cs> <order> <x>)
#? * (gsl_cheb_eval_n_err <cs> <order> <x> <result> <abserr>)
#? * (gsl_cheb_eval_mode <cs> <x> <mode>)
#? * (gsl_cheb_eval_mode_e <cs> <x> <mode> <result> <abserr>)
#? * (gsl_cheb_calc_deriv <deriv> <cs>)
#? * (gsl_cheb_calc_integ <integ> <cs>)

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


(de gsl_cheb_alloc (    order )
    ((-int-) order)                     ;; size_t -> int
    (gptr #{ gsl_cheb_alloc(  $order) #} )          ;; gsl_cheb_series * -> gptr
)



(de gsl_cheb_free (    cs )
    ((-gptr- "gsl_cheb_series *") cs) 
    #{ gsl_cheb_free(  $cs) #} 
    ()
)



(de gsl_cheb_init (    cs  func  a  b )
    ((-gptr- "gsl_cheb_series *") cs) 
    ((-gptr- "const gsl_function *") func) 
    ((-double-) a) 
    ((-double-) b) 
    (int #{ gsl_cheb_init(  $cs ,$func ,$a ,$b) #} )
)




(de gsl_cheb_eval (    cs  x )
    ((-gptr- "const gsl_cheb_series *") cs) 
    ((-double-) x) 
    (double #{ gsl_cheb_eval(  $cs ,$x) #} )
)


(de gsl_cheb_eval_err (    cs  x  result  abserr )
    ((-gptr- "const gsl_cheb_series *") cs) 
    ((-double-) x) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_cheb_eval_err(  $cs ,$x ,$result ,$abserr) #} )
)




(de gsl_cheb_eval_n (    cs  order  x )
    ((-gptr- "const gsl_cheb_series *") cs) 
    ((-int-) order)                     ;; size_t -> int
    ((-double-) x) 
    (double #{ gsl_cheb_eval_n(  $cs ,$order ,$x) #} )
)

(de gsl_cheb_eval_n_err (    cs  order  x  result  abserr )
    ((-gptr- "const gsl_cheb_series *") cs) 
    ((-int-) order)                     ;; size_t -> int
    ((-double-) x) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_cheb_eval_n_err(  $cs ,$order ,$x ,$result ,$abserr) #} )
)




(de gsl_cheb_eval_mode (    cs  x  mode )
    ((-gptr- "const gsl_cheb_series *") cs) 
    ((-double-) x) 
    ((-int-) mode)                    ;; gsl_mode_t (unsigned int) -> int
    (double #{ gsl_cheb_eval_mode(  $cs ,$x ,$mode) #} )
)

(de gsl_cheb_eval_mode_e (    cs  x  mode  result  abserr )
    ((-gptr- "const gsl_cheb_series *") cs) 
    ((-double-) x) 
    ((-int-) mode)                    ;; gsl_mode_t (unsigned int ) -> int
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_cheb_eval_mode_e(  $cs ,$x ,$mode ,$result ,$abserr) #} )
)





(de gsl_cheb_calc_deriv (    deriv  cs )
    ((-gptr- "gsl_cheb_series *") deriv) 
    ((-gptr- "const gsl_cheb_series *") cs) 
    (int #{ gsl_cheb_calc_deriv(  $deriv ,$cs) #} )
)



(de gsl_cheb_calc_integ (    integ  cs )
    ((-gptr- "gsl_cheb_series *") integ) 
    ((-gptr- "const gsl_cheb_series *") cs) 
    (int #{ gsl_cheb_calc_integ(  $integ ,$cs) #} )
)



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

(dhc-make ()
  dummy_cheb
  gsl_cheb_alloc
  gsl_cheb_free
  gsl_cheb_init
  gsl_cheb_eval
  gsl_cheb_eval_err
  gsl_cheb_eval_n
  gsl_cheb_eval_n_err
  gsl_cheb_eval_mode_e
  gsl_cheb_calc_deriv
  gsl_cheb_calc_integ
)

;;  gsl_cheb_eval_mode