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



#? *** sum

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

#? * (dummy_sum)
#? * (gsl_sum_levin_u_alloc <n>)
#? * (gsl_sum_levin_u_free <w>)
#? * (gsl_sum_levin_u_accel <array> <n> <w> <sum_accel> <abserr>)
#? * (gsl_sum_levin_u_minmax <array> <n> <min_terms> <max_terms> <w> <sum_accel> <abserr>)
#? * (gsl_sum_levin_u_step <term> <n> <nmax> <w> <sum_accel>)
#? * (gsl_sum_levin_utrunc_alloc <n>)
#? * (gsl_sum_levin_utrunc_free <w>)
#? * (gsl_sum_levin_utrunc_accel <array> <n> <w> <sum_accel> <abserr_trunc>)
#? * (gsl_sum_levin_utrunc_minmax <array> <n> <min_terms> <max_terms> <w> <sum_accel> <abserr_trunc>)
#? * (gsl_sum_levin_utrunc_step <term> <n> <w> <sum_accel>)

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



(de gsl_sum_levin_u_alloc (    n )
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_sum_levin_u_alloc (  $n) #} )          ;; gsl_sum_levin_u_workspace * -> gptr
)

(de gsl_sum_levin_u_free (    w )
    ((-gptr- "gsl_sum_levin_u_workspace *") w) 
    #{ gsl_sum_levin_u_free (  $w) #} 
    ()
)




(de gsl_sum_levin_u_accel (     array  n  w   sum_accel   abserr )
    ((-gptr- "const double *") array) 
    ((-int-) n)                     ;; size_t -> int
    ((-gptr- "gsl_sum_levin_u_workspace *") w) 
    ((-gptr- "double *") sum_accel) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_sum_levin_u_accel (  $array ,$n ,$w ,$sum_accel ,$abserr) #} )
)




(de gsl_sum_levin_u_minmax (     array  n  min_terms  max_terms  w   sum_accel   abserr )
    ((-gptr- "const double *") array) 
    ((-int-) n)                     ;; size_t -> int
    ((-int-) min_terms)                     ;; size_t -> int
    ((-int-) max_terms)                     ;; size_t -> int
    ((-gptr- "gsl_sum_levin_u_workspace *") w) 
    ((-gptr- "double *") sum_accel) 
    ((-gptr- "double *") abserr) 
    (int #{ gsl_sum_levin_u_minmax (  $array ,$n ,$min_terms ,$max_terms ,$w ,$sum_accel ,$abserr) #} )
)




(de gsl_sum_levin_u_step (    term  n  nmax  w   sum_accel )
    ((-double-) term) 
    ((-int-) n)                     ;; size_t -> int
    ((-int-) nmax)                     ;; size_t -> int
    ((-gptr- "gsl_sum_levin_u_workspace *") w) 
    ((-gptr- "double *") sum_accel) 
    (int #{ gsl_sum_levin_u_step (  $term ,$n ,$nmax ,$w ,$sum_accel) #} )
)




(de gsl_sum_levin_utrunc_alloc (    n )
    ((-int-) n)                     ;; size_t -> int
    (gptr #{ gsl_sum_levin_utrunc_alloc (  $n) #} )          ;; gsl_sum_levin_utrunc_workspace * -> gptr
)

(de gsl_sum_levin_utrunc_free (    w )
    ((-gptr- "gsl_sum_levin_utrunc_workspace *") w) 
    #{ gsl_sum_levin_utrunc_free (  $w) #} 
    ()
)


(de gsl_sum_levin_utrunc_accel (     array  n  w   sum_accel   abserr_trunc )
    ((-gptr- "const double *") array) 
    ((-int-) n)                     ;; size_t -> int
    ((-gptr- "gsl_sum_levin_utrunc_workspace *") w) 
    ((-gptr- "double *") sum_accel) 
    ((-gptr- "double *") abserr_trunc) 
    (int #{ gsl_sum_levin_utrunc_accel (  $array ,$n ,$w ,$sum_accel ,$abserr_trunc) #} )
)


(de gsl_sum_levin_utrunc_minmax (     array  n  min_terms  max_terms  w   sum_accel   abserr_trunc )
    ((-gptr- "const double *") array) 
    ((-int-) n)                     ;; size_t -> int
    ((-int-) min_terms)                     ;; size_t -> int
    ((-int-) max_terms)                     ;; size_t -> int
    ((-gptr- "gsl_sum_levin_utrunc_workspace *") w) 
    ((-gptr- "double *") sum_accel) 
    ((-gptr- "double *") abserr_trunc) 
    (int #{ gsl_sum_levin_utrunc_minmax (  $array ,$n ,$min_terms ,$max_terms ,$w ,$sum_accel ,$abserr_trunc) #} )
)


(de gsl_sum_levin_utrunc_step (    term  n  w   sum_accel )
    ((-double-) term) 
    ((-int-) n)                     ;; size_t -> int
    ((-gptr- "gsl_sum_levin_utrunc_workspace *") w) 
    ((-gptr- "double *") sum_accel) 
    (int #{ gsl_sum_levin_utrunc_step (  $term ,$n ,$w ,$sum_accel) #} )
)

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

(dhc-make ()
  dummy_sum
  gsl_sum_levin_u_alloc
  gsl_sum_levin_u_free
  gsl_sum_levin_u_accel
  gsl_sum_levin_u_minmax
  gsl_sum_levin_u_step
  gsl_sum_levin_utrunc_alloc
  gsl_sum_levin_utrunc_free
  gsl_sum_levin_utrunc_accel
  gsl_sum_levin_utrunc_minmax
  gsl_sum_levin_utrunc_step
)
