Commit 91947e9c authored by liam's avatar liam
Browse files

Separate the return structures for special functions

sf-result, sf-result-e10, etc.


git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3163 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent 703c7591
......@@ -3,7 +3,7 @@
; description: Definition of GSLL system
; date:
; author: Liam Healy
; modified: Sun Dec 31 2006 - 22:07
; modified: Mon Jan 1 2007 - 11:38
;********************************************************
;;; $Id: $
......@@ -44,34 +44,35 @@
(:module special-functions
:depends-on (init)
:components
((:file "airy")
(:file "bessel")
(:file "clausen")
(:file "coulomb")
(:file "coupling")
(:file "dawson")
(:file "debye")
(:file "dilogarithm")
(:file "elementary")
(:file "elliptic-integrals")
(:file "elliptic-functions")
(:file "error-functions")
(:file "exponential-functions")
(:file "exponential-integrals")
(:file "fermi-dirac")
(:file "gamma")
(:file "gegenbauer")
(:file "hypergeometric")
(:file "laguerre")
(:file "lambert")
(:file "legendre")
(:file "logarithm")
(:file "power")
(:file "psi")
(:file "synchrotron")
(:file "transport")
(:file "trigonometry")
(:file "zeta")))
((:file "return-structures")
(:file "airy" :depends-on (return-structures))
(:file "bessel" :depends-on (return-structures))
(:file "clausen" :depends-on (return-structures))
(:file "coulomb" :depends-on (return-structures))
(:file "coupling" :depends-on (return-structures))
(:file "dawson" :depends-on (return-structures))
(:file "debye" :depends-on (return-structures))
(:file "dilogarithm" :depends-on (return-structures))
(:file "elementary" :depends-on (return-structures))
(:file "elliptic-integrals" :depends-on (return-structures))
(:file "elliptic-functions" :depends-on (return-structures))
(:file "error-functions" :depends-on (return-structures))
(:file "exponential-functions" :depends-on (return-structures))
(:file "exponential-integrals" :depends-on (return-structures))
(:file "fermi-dirac" :depends-on (return-structures))
(:file "gamma" :depends-on (return-structures))
(:file "gegenbauer" :depends-on (return-structures))
(:file "hypergeometric" :depends-on (return-structures))
(:file "laguerre" :depends-on (return-structures))
(:file "lambert" :depends-on (return-structures))
(:file "legendre" :depends-on (return-structures))
(:file "logarithm" :depends-on (return-structures))
(:file "power" :depends-on (return-structures))
(:file "psi" :depends-on (return-structures))
(:file "synchrotron" :depends-on (return-structures))
(:file "transport" :depends-on (return-structures))
(:file "trigonometry" :depends-on (return-structures))
(:file "zeta" :depends-on (return-structures))))
(:file "sorting" :depends-on (init data))
(:module linear-algebra
:depends-on (init data)
......
......@@ -3,46 +3,12 @@
; description: Common structures defined by GSL.
; date: Sun May 28 2006 - 22:04
; author: Liam M. Healy
; modified: Mon Jun 26 2006 - 21:38
; modified: Mon Jan 1 2007 - 11:35
;********************************************************
;;; $Id: $
(in-package :gsl)
;;;;****************************************************************************
;;;; Result from special functions
;;;;****************************************************************************
(cffi:defcstruct sf-result
"Results from special functions with value and error estimate."
;; file:///usr/share/doc/gsl-ref-html/gsl-ref_7.html#SEC61
(val :double)
(err :double))
(cffi:defcstruct sf-result-e10
"Results from special functions with value, error estimate
and a scaling exponent e10, such that the value is val*10^e10."
;; file:///usr/share/doc/gsl-ref-html/gsl-ref_7.html#SEC61
(val :double)
(err :double)
(e10 :int))
(cffi:defcenum sf-mode
"Numerical precision modes with which to calculate special functions."
;; file:///usr/share/doc/gsl-ref-html/gsl-ref_7.html#SEC62
:double-prec
:single-prec
:approx-prec)
(defun val (sf-result &optional (type 'sf-result))
(cffi:foreign-slot-value sf-result type 'val))
(defun err (sf-result &optional (type 'sf-result))
(cffi:foreign-slot-value sf-result type 'err))
(defun e10 (sf-result)
(cffi:foreign-slot-value sf-result 'sf-result-e10 'e10))
;;;;****************************************************************************
;;;; Complex numbers
;;;;****************************************************************************
......@@ -117,13 +83,3 @@ and a scaling exponent e10, such that the value is val*10^e10."
(err ,(st-symbol decl) 'sf-result-e10)))
(t `((,(cl-convert-function (st-type decl)) ,(st-symbol decl)))))))
;;; obsolete; just do this manually for the few cases of multiple sf-result returns?
(defun rearrange-sf-result-err (return-list)
"Put the 'err values from the sf-results at the end of the return values."
(flet ((sf-err (x)
(and (eq (first x) 'cffi:foreign-slot-value)
(member (third x) '('sf-result 'sf-result-e10) :test #'equal)
(equal (fourth x) ''err))))
(append
(remove-if #'sf-err return-list)
(remove-if-not #'sf-err return-list))))
;********************************************************
; file: return-structures.lisp
; description: Structures returned by special functions.
; date: Mon Jan 1 2007 - 11:35
; author: Liam M. Healy
; modified: Mon Jan 1 2007 - 11:35
;********************************************************
;;; $Id: $
(in-package :gsl)
;;;;****************************************************************************
;;;; Result from special functions
;;;;****************************************************************************
(cffi:defcstruct sf-result
"Results from special functions with value and error estimate."
;; file:///usr/share/doc/gsl-ref-html/gsl-ref_7.html#SEC61
(val :double)
(err :double))
(cffi:defcstruct sf-result-e10
"Results from special functions with value, error estimate
and a scaling exponent e10, such that the value is val*10^e10."
;; file:///usr/share/doc/gsl-ref-html/gsl-ref_7.html#SEC61
(val :double)
(err :double)
(e10 :int))
(cffi:defcenum sf-mode
"Numerical precision modes with which to calculate special functions."
;; file:///usr/share/doc/gsl-ref-html/gsl-ref_7.html#SEC62
:double-prec
:single-prec
:approx-prec)
(defun val (sf-result &optional (type 'sf-result))
(cffi:foreign-slot-value sf-result type 'val))
(defun err (sf-result &optional (type 'sf-result))
(cffi:foreign-slot-value sf-result type 'err))
(defun e10 (sf-result)
(cffi:foreign-slot-value sf-result 'sf-result-e10 'e10))
;;; obsolete; just do this manually for the few cases of multiple sf-result returns?
(defun rearrange-sf-result-err (return-list)
"Put the 'err values from the sf-results at the end of the return values."
(flet ((sf-err (x)
(and (eq (first x) 'cffi:foreign-slot-value)
(member (third x) '('sf-result 'sf-result-e10) :test #'equal)
(equal (fourth x) ''err))))
(append
(remove-if #'sf-err return-list)
(remove-if-not #'sf-err return-list))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment