Use feature for GSL2; abort for now if present

Abort loading with explanation that GSLL does not yet work with GSL
2. Replace incorrect combination of read-time evaluation and read-time
feature with a regular read-time feature on the symbol :gsl2 for when
support is completed.
parent 2d3c6598
;; GSL library version
;; Liam Healy 2016-08-06 10:37:52EDT gsl-version.lisp
;; Time-stamp: <2016-08-06 10:48:20EDT gsl-version.lisp>
;; Time-stamp: <2016-08-06 22:05:11EDT gsl-version.lisp>
;;
;; Copyright 2016 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -20,17 +20,25 @@
(in-package :gsl)
(cffi:defcvar ("gsl_version" *gsl-version* :read-only t) :string
"The version of the GSL library being used.")
(export '*gsl-version*)
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun have-at-least-gsl-version (major-minor)
"The GSL version currently running is at least the specified major/minor version."
(or (null major-minor)
(let* ((sep-pos (position #\. *gsl-version*))
(my-major
(read-from-string *gsl-version* nil nil :end sep-pos))
(my-minor
(read-from-string *gsl-version* nil nil :start (1+ sep-pos))))
(and (>= my-major (first major-minor))
(>= my-minor (second major-minor))))))
(cffi:defcvar ("gsl_version" *gsl-version* :read-only t) :string
"The version of the GSL library being used.")
(export '*gsl-version*)
(defun have-at-least-gsl-version (major-minor)
"The GSL version currently running is at least the specified major/minor version."
(or (null major-minor)
(let* ((sep-pos (position #\. *gsl-version*))
(my-major
(read-from-string *gsl-version* nil nil :end sep-pos))
(my-minor
(read-from-string *gsl-version* nil nil :start (1+ sep-pos))))
(and (>= my-major (first major-minor))
(>= my-minor (second major-minor))))))
)
(when (have-at-least-gsl-version '(2 0))
(pushnew :gsl2 *features*)
;; Following form to be deleted when GSL 2 support is present
(error "GSLL does not currently work with GSL version 2.x"))
;; Linear least squares, or linear regression
;; Liam Healy <2008-01-21 12:41:46EST linear-least-squares.lisp>
;; Time-stamp: <2016-08-06 12:26:24EDT linear-least-squares.lisp>
;; Time-stamp: <2016-08-06 22:01:47EDT linear-least-squares.lisp>
;;
;; Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2016 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -223,7 +223,7 @@
Any components which have zero singular value (to machine
precision) are discarded from the fit.")
#-#.(gsl::have-at-least-gsl-version '(2 0)) ; GSL v1.x
#-gsl2 ; GSL v1.x
(defmfun linear-mfit-svd
(model observations parameters-or-size tolerance
&optional weight
......@@ -259,7 +259,7 @@
The best-fit is found by singular value decomposition of the matrix model using the preallocated workspace provided. The modified Golub-Reinsch SVD algorithm is used, with column scaling to improve the accuracy of the singular values (unweighted). Any components which have zero singular value (to machine precision) are discarded from the fit. In the second form of the function the components are discarded if the ratio of singular values s_i/s_0 falls below the user-specified tolerance, and the effective rank is returned as the second value.")
#+#.(gsl::have-at-least-gsl-version '(2 0)) ; GSL v2.x
#+gsl2 ; GSL v2.x
(defmfun linear-mfit-svd
(model observations parameters-or-size tolerance
&optional weight
......
;; Elliptic integrals
;; Liam Healy, Mon Mar 20 2006 - 21:50
;; Time-stamp: <2016-08-06 11:49:54EDT elliptic-integrals.lisp>
;; Time-stamp: <2016-08-06 22:03:19EDT elliptic-integrals.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2011, 2016 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -65,14 +65,14 @@
parameters m = k^2 and sin^2(alpha) = k^2, with the change of sign
n to -n.")
#-#.(gsl::have-at-least-gsl-version '(2 0)) ; GSL v1.x
#-gsl2 ; GSL v1.x
(defmfun elliptic-integral-D (phi k n &optional (mode :double))
"gsl_sf_ellint_D_e"
((phi :double) (k :double) (n :double) (mode sf-mode) (ret (:pointer (:struct sf-result))))
:documentation ; GSL texi
"The incomplete elliptic integral D(phi,k,n) which is defined through the Carlson form RD(x,y,z) by the relation D(phi,k,n) = RD (1-sin^2(phi), 1-k^2 sin^2(phi), 1).")
#+#.(gsl::have-at-least-gsl-version '(2 0)) ; GSL v2.x
#+gsl2 ; GSL v2.x
(defmfun elliptic-integral-D (phi k &optional (mode :double))
"gsl_sf_ellint_D_e"
((phi :double) (k :double) (mode sf-mode) (ret (:pointer (:struct sf-result))))
......
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