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



#? *** integration

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

#? * (dummy_integration)
#? * (gsl_integration_workspace_alloc <n>)
#? * (gsl_integration_workspace_free <w>)
#? * (gsl_integration_qaws_table_alloc <alpha> <beta> <mu> <nu>)
#? * (gsl_integration_qaws_table_set <p> <alpha> <beta> <mu> <nu>)
#? * (gsl_integration_qaws_table_free <p>)
#? * (gsl_integration_qawo_table_alloc <omega> <l> <sine> <n>)
#? * (gsl_integration_qawo_table_set <p> <omega> <l> <sine>)
#? * (gsl_integration_qawo_table_set_length <p> <l>)
#? * (gsl_integration_qawo_table_free <p>)
#? * (gsl_integration_qk15 <f> <a> <b> <result> <abserr> <resabs> <resasc>)
#? * (gsl_integration_qk21 <f> <a> <b> <result> <abserr> <resabs> <resasc>)
#? * (gsl_integration_qk31 <f> <a> <b> <result> <abserr> <resabs> <resasc>)
#? * (gsl_integration_qk41 <f> <a> <b> <result> <abserr> <resabs> <resasc>)
#? * (gsl_integration_qk51 <f> <a> <b> <result> <abserr> <resabs> <resasc>)
#? * (gsl_integration_qk61 <f> <a> <b> <result> <abserr> <resabs> <resasc>)
#? * (gsl_integration_qcheb <f> <a> <b> <cheb12> <cheb24>)
#? * (gsl_integration_qk <n> <xgk> <wg> <wgk> <fv1> <fv2> <f> <a> <b> <result> <abserr> <resabs> <resasc>)
#? * (gsl_integration_qng <f> <a> <b> <epsabs> <epsrel> <result> <abserr> <neval>)
#? * (gsl_integration_qag <f> <a> <b> <epsabs> <epsrel> <limit> <key> <workspace> <result> <abserr>)
#? * (gsl_integration_qagi <f> <epsabs> <epsrel> <limit> <workspace> <result> <abserr>)
#? * (gsl_integration_qagiu <f> <a> <epsabs> <epsrel> <limit> <workspace> <result> <abserr>)
#? * (gsl_integration_qagil <f> <b> <epsabs> <epsrel> <limit> <workspace> <result> <abserr>)
#? * (gsl_integration_qags <f> <a> <b> <epsabs> <epsrel> <limit> <workspace> <result> <abserr>)
#? * (gsl_integration_qagp <f> <pts> <npts> <epsabs> <epsrel> <limit> <workspace> <result> <abserr>)
#? * (gsl_integration_qawc <f> <a> <b> <c> <epsabs> <epsrel> <limit> <workspace> <result> <abserr>)
#? * (gsl_integration_qaws <f> <a> <b> <p> <epsabs> <epsrel> <limit> <workspace> <result> <abserr>)
#? * (gsl_integration_qawo <f> <a> <epsabs> <epsrel> <limit> <workspace> <wf> <result> <abserr>)
#? * (gsl_integration_qawf <f> <a> <epsabs> <limit> <workspace> <cycle_workspace> <wf> <result> <abserr>)

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


(de gsl_integration_workspace_alloc (    n )
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_integration_workspace_alloc (  $n) #} )          ;; gsl_integration_workspace * -> gptr
)


(de gsl_integration_workspace_free (    w )
    ((-gptr- "gsl_integration_workspace *") w) 
    #{ gsl_integration_workspace_free (  $w) #} 
    ()
)





(de gsl_integration_qaws_table_alloc (    alpha  beta  mu  nu )
    ((-double-) alpha) 
    ((-double-) beta) 
    ((-int-) mu) 
    ((-int-) nu) 
    (gptr #{ gsl_integration_qaws_table_alloc (  $alpha ,$beta ,$mu ,$nu) #} )          ;; gsl_integration_qaws_table * -> gptr
)


(de gsl_integration_qaws_table_set (    p  alpha  beta  mu  nu )
    ((-gptr- "gsl_integration_qaws_table *") p) 
    ((-double-) alpha) 
    ((-double-) beta) 
    ((-int-) mu) 
    ((-int-) nu) 
    (int #{ gsl_integration_qaws_table_set (  $p ,$alpha ,$beta ,$mu ,$nu) #} )
)


(de gsl_integration_qaws_table_free (    p )
    ((-gptr- "gsl_integration_qaws_table *") p) 
    #{ gsl_integration_qaws_table_free (  $p) #} 
    ()
)






(de gsl_integration_qawo_table_alloc (    omega  l  sine  n )
    ((-double-) omega) 
    ((-double-) l) 
    ((-int-) sine)                        ;; enum gsl_integration_qawo_enum -> int
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_integration_qawo_table_alloc (  $omega ,$l ,$sine ,$n) #} )          ;; gsl_integration_qawo_table * -> gptr
)


(de gsl_integration_qawo_table_set (    p  omega  l  sine )
    ((-gptr- "gsl_integration_qawo_table *") p) 
    ((-double-) omega) 
    ((-double-) l) 
    ((-int-) sine)                       ;; enum gsl_integration_qawo_enum
    (int #{ gsl_integration_qawo_table_set (  $p ,$omega ,$l ,$sine) #} )
)


(de gsl_integration_qawo_table_set_length (    p  l )
    ((-gptr- "gsl_integration_qawo_table *") p) 
    ((-double-) l) 
    (int #{ gsl_integration_qawo_table_set_length (  $p ,$l) #} )
)


(de gsl_integration_qawo_table_free (    p )
    ((-gptr- "gsl_integration_qawo_table *") p) 
    #{ gsl_integration_qawo_table_free (  $p) #} 
    ()
)





(de gsl_integration_qk15 (    f  a  b   result   abserr   resabs   resasc )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "double *") resabs) 
    ((-gptr- "double *") resasc) 
    #{ gsl_integration_qk15 (  $f ,$a ,$b ,$result ,$abserr ,$resabs ,$resasc) #} 
    ()
)


(de gsl_integration_qk21 (    f  a  b   result   abserr   resabs   resasc )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "double *") resabs) 
    ((-gptr- "double *") resasc) 
    #{ gsl_integration_qk21 (  $f ,$a ,$b ,$result ,$abserr ,$resabs ,$resasc) #} 
    ()
)


(de gsl_integration_qk31 (    f  a  b   result   abserr   resabs   resasc )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "double *") resabs) 
    ((-gptr- "double *") resasc) 
    #{ gsl_integration_qk31 (  $f ,$a ,$b ,$result ,$abserr ,$resabs ,$resasc) #} 
    ()
)


(de gsl_integration_qk41 (    f  a  b   result   abserr   resabs   resasc )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "double *") resabs) 
    ((-gptr- "double *") resasc) 
    #{ gsl_integration_qk41 (  $f ,$a ,$b ,$result ,$abserr ,$resabs ,$resasc) #} 
    ()
)


(de gsl_integration_qk51 (    f  a  b   result   abserr   resabs   resasc )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "double *") resabs) 
    ((-gptr- "double *") resasc) 
    #{ gsl_integration_qk51 (  $f ,$a ,$b ,$result ,$abserr ,$resabs ,$resasc) #} 
    ()
)


(de gsl_integration_qk61 (    f  a  b   result   abserr   resabs   resasc )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "double *") resabs) 
    ((-gptr- "double *") resasc) 
    #{ gsl_integration_qk61 (  $f ,$a ,$b ,$result ,$abserr ,$resabs ,$resasc) #} 
    ()
)


(de gsl_integration_qcheb (    f  a  b   cheb12   cheb24 )
    ((-gptr- "gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") cheb12) 
    ((-gptr- "double *") cheb24) 
    #{ gsl_integration_qcheb (  $f ,$a ,$b ,$cheb12 ,$cheb24) #} 
    ()
)




(de gsl_integration_qk (    n  xgk  wg  wgk  fv1  fv2   f  a  b  result  abserr  resabs  resasc )
    ((-int-) n) 
    ((-gptr- "const double *") xgk) 
    ((-gptr- "const double *") wg) 
    ((-gptr- "const double *") wgk) 
    ((-gptr- "double *") fv1) 
    ((-gptr- "double *") fv2) 
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "double *") resabs) 
    ((-gptr- "double *") resasc) 
    #{ gsl_integration_qk (  $n ,$xgk ,$wg ,$wgk ,$fv1 ,$fv2 ,$f ,$a ,$b ,$result ,$abserr ,$resabs ,$resasc) #} 
    ()
)



(de gsl_integration_qng (    f  a  b  epsabs  epsrel   result   abserr  neval )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    ((-gptr- "size_t *") neval) 
    (int #{ gsl_integration_qng (  $f ,$a ,$b ,$epsabs ,$epsrel ,$result ,$abserr ,$neval) #} )
)


(de gsl_integration_qag (    f  a  b  epsabs  epsrel  limit  key  workspace   result   abserr )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-int-) key) 
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qag (  $f ,$a ,$b ,$epsabs ,$epsrel ,$limit ,$key ,$workspace ,$result ,$abserr) #} )
)


(de gsl_integration_qagi (    f  epsabs  epsrel  limit  workspace   result   abserr )
    ((-gptr- "gsl_function *") f) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qagi (  $f ,$epsabs ,$epsrel ,$limit ,$workspace ,$result ,$abserr) #} )
)


(de gsl_integration_qagiu (    f  a  epsabs  epsrel  limit  workspace   result   abserr )
    ((-gptr- "gsl_function *") f) 
    ((-double-) a) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qagiu (  $f ,$a ,$epsabs ,$epsrel ,$limit ,$workspace ,$result ,$abserr) #} )
)


(de gsl_integration_qagil (    f  b  epsabs  epsrel  limit  workspace   result   abserr )
    ((-gptr- "gsl_function *") f) 
    ((-double-) b) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qagil (  $f ,$b ,$epsabs ,$epsrel ,$limit ,$workspace ,$result ,$abserr) #} )
)



(de gsl_integration_qags (    f  a  b  epsabs  epsrel  limit  workspace   result   abserr )
    ((-gptr- "const gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qags (  $f ,$a ,$b ,$epsabs ,$epsrel ,$limit ,$workspace ,$result ,$abserr) #} )
)


(de gsl_integration_qagp (    f   pts  npts  epsabs  epsrel  limit  workspace   result   abserr )
    ((-gptr- "const gsl_function *") f) 
    ((-gptr- "double *") pts) 
    ((-int-) npts)                     ;; size_t -> int
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qagp (  $f ,$pts ,$npts ,$epsabs ,$epsrel ,$limit ,$workspace ,$result ,$abserr) #} )
)


(de gsl_integration_qawc (     f  a  b  c  epsabs  epsrel  limit  workspace  result  abserr )
    ((-gptr- "gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-double-) c) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qawc (  $f ,$a ,$b ,$c ,$epsabs ,$epsrel ,$limit ,$workspace ,$result ,$abserr) #} )
)


(de gsl_integration_qaws (    f  a  b  p  epsabs  epsrel  limit  workspace   result   abserr )
    ((-gptr- "gsl_function *") f) 
    ((-double-) a) 
    ((-double-) b) 
    ((-gptr- "gsl_integration_qaws_table *") p) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qaws (  $f ,$a ,$b ,$p ,$epsabs ,$epsrel ,$limit ,$workspace ,$result ,$abserr) #} )
)


(de gsl_integration_qawo (    f  a  epsabs  epsrel  limit  workspace  wf   result   abserr )
    ((-gptr- "gsl_function *") f) 
    ((-double-) a) 
    ((-double-) epsabs) 
    ((-double-) epsrel) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "gsl_integration_qawo_table *") wf) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qawo (  $f ,$a ,$epsabs ,$epsrel ,$limit ,$workspace ,$wf ,$result ,$abserr) #} )
)


(de gsl_integration_qawf (    f  a  epsabs  limit  workspace  cycle_workspace  wf   result   abserr )
    ((-gptr- "gsl_function *") f) 
    ((-double-) a) 
    ((-double-) epsabs) 
    ((-int-) limit)                     ;; size_t -> int
    ((-gptr- "gsl_integration_workspace *") workspace) 
    ((-gptr- "gsl_integration_workspace *") cycle_workspace) 
    ((-gptr- "gsl_integration_qawo_table *") wf) 
    ((-gptr- "double *") result) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_integration_qawf (  $f ,$a ,$epsabs ,$limit ,$workspace ,$cycle_workspace ,$wf ,$result ,$abserr) #} )
)


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

(dhc-make ()
  dummy_integration
  gsl_integration_workspace_alloc
  gsl_integration_workspace_free
  gsl_integration_qaws_table_alloc
  gsl_integration_qaws_table_set
  gsl_integration_qaws_table_free
  gsl_integration_qawo_table_alloc
  gsl_integration_qawo_table_set
  gsl_integration_qawo_table_set_length
  gsl_integration_qawo_table_free
  gsl_integration_qk15
  gsl_integration_qk21
  gsl_integration_qk31
  gsl_integration_qk41
  gsl_integration_qk51
  gsl_integration_qk61
  gsl_integration_qcheb
  gsl_integration_qk
  gsl_integration_qng
  gsl_integration_qag
  gsl_integration_qagi
  gsl_integration_qagiu
  gsl_integration_qagil
  gsl_integration_qags
  gsl_integration_qagp
  gsl_integration_qawc
  gsl_integration_qaws
  gsl_integration_qawo
  gsl_integration_qawf
)
