Loading test-unit/convert.lisp +17 −1 Original line number Diff line number Diff line ;; Convert the GSL tests ;; Liam Healy 2010-05-22 13:03:53EDT convert.lisp ;; Time-stamp: <2010-07-21 13:27:06EDT convert.lisp> ;; Time-stamp: <2014-01-21 16:16:59EST convert.lisp> ;; Copyright 2010, 2014 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; 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 3 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, see <http://www.gnu.org/licenses/>. ;;; This file is not normally loaded; it is only used to convert the ;;; GSL tests in C to CL tests. It requires cl-ppcre, alexandria, and iterate. Loading test-unit/gsl-tests.lisp 0 → 100644 +57 −0 Original line number Diff line number Diff line ;; GSL defined tests ;; Liam Healy 2014-01-21 10:42:48EST gsl-tests.lisp ;; Time-stamp: <2014-01-21 16:14:55EST gsl-tests.lisp> ;; Copyright 2014 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; 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 3 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, see <http://www.gnu.org/licenses/>. (in-package :gsl) ;;; GSL test functions are defined in gsl-1.16/test/results.i. ;;; Need constants in ~/mathematics/gsl-1.16/gsl_machine.h (defparameter *gsl-test-verbose* t) (defun gsl-test-rel (result expected relative-error test-description &optional (verbose *gsl-test-verbose*)) ;; Instead of "status" integer, we return T for passing and a symbol for the category of failure. (let ((status (cond ((or (nanp result) (nanp expected)) (or (eql (nanp result) (nanp expected)) :nan)) ((or (infinityp result) (infinityp expected)) (or (eql (infinityp result) (infinityp expected)) :infinity)) ((or (and (plusp expected) (< expected +DBL-MIN+)) (and (minusp expected) (> expected (- +DBL-MIN+)))) :double-float-range) ((not (zerop expected)) (or (<= (/ (abs (- result expected)) (abs expected)) relative-error) :nonzero-relative-error)) (t (or (<= (abs result) relative-error) :absolute-error))))) (if (or verbose (not (eql status t))) (if (eql status t) (format t "PASS~8t~a~8t~g observed vs. ~g expected" test-description result expected) (format t "FAIL~8t~a~8t~a, ~g observed vs. ~g expected" status test-description result expected))))) ;; TEST(gsl_cdf_beta_P, (0.0000000000000000e+00,1.3,2.7), 0.000000000000e+00, TEST_TOL6); ;; gsl-lookup("gsl_cdf_beta_P") ;; (gsl-test-rel (BETA-P 0.0000000000000000d+00 1.3d0 2.7d0) 0.000000000000d+00 +TEST-TOL6+ "(BETA-P 0.0000000000000000d+00 1.3d0 2.7d0)" t) test-unit/machine.lisp +65 −6 Original line number Diff line number Diff line ;; Constants specifying limits of floating point calculations in hardware ;; Liam Healy ;; Time-stamp: <2010-08-22 21:19:38EDT machine.lisp> ;; Time-stamp: <2014-01-21 12:41:48EST machine.lisp> ;; ;; Copyright 2010 Liam M. Healy ;; Copyright 2010, 2014 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; This program is free software: you can redistribute it and/or modify Loading Loading @@ -30,7 +30,66 @@ (include "gsl/gsl_machine.h") (constant (+dbl-epsilon+ "GSL_DBL_EPSILON") :type double-float) (constant (+sgl-epsilon+ "GSL_FLT_EPSILON") :type double-float) (constant (+sqrt-dbl-epsilon+ "GSL_SQRT_DBL_EPSILON") :type double-float) (constant (+log-dbl-max+ "GSL_LOG_DBL_MAX") :type double-float) (constant (+DBL-EPSILON+ "GSL_DBL_EPSILON") :type double-float) (constant (+SQRT-DBL-EPSILON+ "GSL_SQRT_DBL_EPSILON") :type double-float) (constant (+ROOT3-DBL-EPSILON+ "GSL_ROOT3_DBL_EPSILON") :type double-float) (constant (+ROOT4-DBL-EPSILON+ "GSL_ROOT4_DBL_EPSILON") :type double-float) (constant (+ROOT5-DBL-EPSILON+ "GSL_ROOT5_DBL_EPSILON") :type double-float) (constant (+ROOT6-DBL-EPSILON+ "GSL_ROOT6_DBL_EPSILON") :type double-float) (constant (+LOG-DBL-EPSILON+ "GSL_LOG_DBL_EPSILON") :type double-float) (constant (+DBL-MIN+ "GSL_DBL_MIN") :type double-float) (constant (+SQRT-DBL-MIN+ "GSL_SQRT_DBL_MIN") :type double-float) (constant (+ROOT3-DBL-MIN+ "GSL_ROOT3_DBL_MIN") :type double-float) (constant (+ROOT4-DBL-MIN+ "GSL_ROOT4_DBL_MIN") :type double-float) (constant (+ROOT5-DBL-MIN+ "GSL_ROOT5_DBL_MIN") :type double-float) (constant (+ROOT6-DBL-MIN+ "GSL_ROOT6_DBL_MIN") :type double-float) (constant (+LOG-DBL-MIN+ "GSL_LOG_DBL_MIN") :type double-float) (constant (+DBL-MAX+ "GSL_DBL_MAX") :type double-float) (constant (+SQRT-DBL-MAX+ "GSL_SQRT_DBL_MAX") :type double-float) (constant (+ROOT3-DBL-MAX+ "GSL_ROOT3_DBL_MAX") :type double-float) (constant (+ROOT4-DBL-MAX+ "GSL_ROOT4_DBL_MAX") :type double-float) (constant (+ROOT5-DBL-MAX+ "GSL_ROOT5_DBL_MAX") :type double-float) (constant (+ROOT6-DBL-MAX+ "GSL_ROOT6_DBL_MAX") :type double-float) (constant (+LOG-DBL-MAX+ "GSL_LOG_DBL_MAX") :type double-float) (constant (+FLT-EPSILON+ "GSL_FLT_EPSILON") :type double-float) (constant (+SQRT-FLT-EPSILON+ "GSL_SQRT_FLT_EPSILON") :type double-float) (constant (+ROOT3-FLT-EPSILON+ "GSL_ROOT3_FLT_EPSILON") :type double-float) (constant (+ROOT4-FLT-EPSILON+ "GSL_ROOT4_FLT_EPSILON") :type double-float) (constant (+ROOT5-FLT-EPSILON+ "GSL_ROOT5_FLT_EPSILON") :type double-float) (constant (+ROOT6-FLT-EPSILON+ "GSL_ROOT6_FLT_EPSILON") :type double-float) (constant (+LOG-FLT-EPSILON+ "GSL_LOG_FLT_EPSILON") :type double-float) (constant (+FLT-MIN+ "GSL_FLT_MIN") :type double-float) (constant (+SQRT-FLT-MIN+ "GSL_SQRT_FLT_MIN") :type double-float) (constant (+ROOT3-FLT-MIN+ "GSL_ROOT3_FLT_MIN") :type double-float) (constant (+ROOT4-FLT-MIN+ "GSL_ROOT4_FLT_MIN") :type double-float) (constant (+ROOT5-FLT-MIN+ "GSL_ROOT5_FLT_MIN") :type double-float) (constant (+ROOT6-FLT-MIN+ "GSL_ROOT6_FLT_MIN") :type double-float) (constant (+LOG-FLT-MIN+ "GSL_LOG_FLT_MIN") :type double-float) (constant (+FLT-MAX+ "GSL_FLT_MAX") :type double-float) (constant (+SQRT-FLT-MAX+ "GSL_SQRT_FLT_MAX") :type double-float) (constant (+ROOT3-FLT-MAX+ "GSL_ROOT3_FLT_MAX") :type double-float) (constant (+ROOT4-FLT-MAX+ "GSL_ROOT4_FLT_MAX") :type double-float) (constant (+ROOT5-FLT-MAX+ "GSL_ROOT5_FLT_MAX") :type double-float) (constant (+ROOT6-FLT-MAX+ "GSL_ROOT6_FLT_MAX") :type double-float) (constant (+LOG-FLT-MAX+ "GSL_LOG_FLT_MAX") :type double-float) (constant (+SFLT-EPSILON+ "GSL_SFLT_EPSILON") :type double-float) (constant (+SQRT-SFLT-EPSILON+ "GSL_SQRT_SFLT_EPSILON") :type double-float) (constant (+ROOT3-SFLT-EPSILON+ "GSL_ROOT3_SFLT_EPSILON") :type double-float) (constant (+ROOT4-SFLT-EPSILON+ "GSL_ROOT4_SFLT_EPSILON") :type double-float) (constant (+ROOT5-SFLT-EPSILON+ "GSL_ROOT5_SFLT_EPSILON") :type double-float) (constant (+ROOT6-SFLT-EPSILON+ "GSL_ROOT6_SFLT_EPSILON") :type double-float) (constant (+LOG-SFLT-EPSILON+ "GSL_LOG_SFLT_EPSILON") :type double-float) (constant (+SQRT-MACH-EPS+ "GSL_SQRT_MACH_EPS") :type double-float) (constant (+ROOT3-MACH-EPS+ "GSL_ROOT3_MACH_EPS") :type double-float) (constant (+ROOT4-MACH-EPS+ "GSL_ROOT4_MACH_EPS") :type double-float) (constant (+ROOT5-MACH-EPS+ "GSL_ROOT5_MACH_EPS") :type double-float) (constant (+ROOT6-MACH-EPS+ "GSL_ROOT6_MACH_EPS") :type double-float) (constant (+LOG-MACH-EPS+ "GSL_LOG_MACH_EPS") :type double-float) Loading
test-unit/convert.lisp +17 −1 Original line number Diff line number Diff line ;; Convert the GSL tests ;; Liam Healy 2010-05-22 13:03:53EDT convert.lisp ;; Time-stamp: <2010-07-21 13:27:06EDT convert.lisp> ;; Time-stamp: <2014-01-21 16:16:59EST convert.lisp> ;; Copyright 2010, 2014 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; 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 3 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, see <http://www.gnu.org/licenses/>. ;;; This file is not normally loaded; it is only used to convert the ;;; GSL tests in C to CL tests. It requires cl-ppcre, alexandria, and iterate. Loading
test-unit/gsl-tests.lisp 0 → 100644 +57 −0 Original line number Diff line number Diff line ;; GSL defined tests ;; Liam Healy 2014-01-21 10:42:48EST gsl-tests.lisp ;; Time-stamp: <2014-01-21 16:14:55EST gsl-tests.lisp> ;; Copyright 2014 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; 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 3 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, see <http://www.gnu.org/licenses/>. (in-package :gsl) ;;; GSL test functions are defined in gsl-1.16/test/results.i. ;;; Need constants in ~/mathematics/gsl-1.16/gsl_machine.h (defparameter *gsl-test-verbose* t) (defun gsl-test-rel (result expected relative-error test-description &optional (verbose *gsl-test-verbose*)) ;; Instead of "status" integer, we return T for passing and a symbol for the category of failure. (let ((status (cond ((or (nanp result) (nanp expected)) (or (eql (nanp result) (nanp expected)) :nan)) ((or (infinityp result) (infinityp expected)) (or (eql (infinityp result) (infinityp expected)) :infinity)) ((or (and (plusp expected) (< expected +DBL-MIN+)) (and (minusp expected) (> expected (- +DBL-MIN+)))) :double-float-range) ((not (zerop expected)) (or (<= (/ (abs (- result expected)) (abs expected)) relative-error) :nonzero-relative-error)) (t (or (<= (abs result) relative-error) :absolute-error))))) (if (or verbose (not (eql status t))) (if (eql status t) (format t "PASS~8t~a~8t~g observed vs. ~g expected" test-description result expected) (format t "FAIL~8t~a~8t~a, ~g observed vs. ~g expected" status test-description result expected))))) ;; TEST(gsl_cdf_beta_P, (0.0000000000000000e+00,1.3,2.7), 0.000000000000e+00, TEST_TOL6); ;; gsl-lookup("gsl_cdf_beta_P") ;; (gsl-test-rel (BETA-P 0.0000000000000000d+00 1.3d0 2.7d0) 0.000000000000d+00 +TEST-TOL6+ "(BETA-P 0.0000000000000000d+00 1.3d0 2.7d0)" t)
test-unit/machine.lisp +65 −6 Original line number Diff line number Diff line ;; Constants specifying limits of floating point calculations in hardware ;; Liam Healy ;; Time-stamp: <2010-08-22 21:19:38EDT machine.lisp> ;; Time-stamp: <2014-01-21 12:41:48EST machine.lisp> ;; ;; Copyright 2010 Liam M. Healy ;; Copyright 2010, 2014 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; This program is free software: you can redistribute it and/or modify Loading Loading @@ -30,7 +30,66 @@ (include "gsl/gsl_machine.h") (constant (+dbl-epsilon+ "GSL_DBL_EPSILON") :type double-float) (constant (+sgl-epsilon+ "GSL_FLT_EPSILON") :type double-float) (constant (+sqrt-dbl-epsilon+ "GSL_SQRT_DBL_EPSILON") :type double-float) (constant (+log-dbl-max+ "GSL_LOG_DBL_MAX") :type double-float) (constant (+DBL-EPSILON+ "GSL_DBL_EPSILON") :type double-float) (constant (+SQRT-DBL-EPSILON+ "GSL_SQRT_DBL_EPSILON") :type double-float) (constant (+ROOT3-DBL-EPSILON+ "GSL_ROOT3_DBL_EPSILON") :type double-float) (constant (+ROOT4-DBL-EPSILON+ "GSL_ROOT4_DBL_EPSILON") :type double-float) (constant (+ROOT5-DBL-EPSILON+ "GSL_ROOT5_DBL_EPSILON") :type double-float) (constant (+ROOT6-DBL-EPSILON+ "GSL_ROOT6_DBL_EPSILON") :type double-float) (constant (+LOG-DBL-EPSILON+ "GSL_LOG_DBL_EPSILON") :type double-float) (constant (+DBL-MIN+ "GSL_DBL_MIN") :type double-float) (constant (+SQRT-DBL-MIN+ "GSL_SQRT_DBL_MIN") :type double-float) (constant (+ROOT3-DBL-MIN+ "GSL_ROOT3_DBL_MIN") :type double-float) (constant (+ROOT4-DBL-MIN+ "GSL_ROOT4_DBL_MIN") :type double-float) (constant (+ROOT5-DBL-MIN+ "GSL_ROOT5_DBL_MIN") :type double-float) (constant (+ROOT6-DBL-MIN+ "GSL_ROOT6_DBL_MIN") :type double-float) (constant (+LOG-DBL-MIN+ "GSL_LOG_DBL_MIN") :type double-float) (constant (+DBL-MAX+ "GSL_DBL_MAX") :type double-float) (constant (+SQRT-DBL-MAX+ "GSL_SQRT_DBL_MAX") :type double-float) (constant (+ROOT3-DBL-MAX+ "GSL_ROOT3_DBL_MAX") :type double-float) (constant (+ROOT4-DBL-MAX+ "GSL_ROOT4_DBL_MAX") :type double-float) (constant (+ROOT5-DBL-MAX+ "GSL_ROOT5_DBL_MAX") :type double-float) (constant (+ROOT6-DBL-MAX+ "GSL_ROOT6_DBL_MAX") :type double-float) (constant (+LOG-DBL-MAX+ "GSL_LOG_DBL_MAX") :type double-float) (constant (+FLT-EPSILON+ "GSL_FLT_EPSILON") :type double-float) (constant (+SQRT-FLT-EPSILON+ "GSL_SQRT_FLT_EPSILON") :type double-float) (constant (+ROOT3-FLT-EPSILON+ "GSL_ROOT3_FLT_EPSILON") :type double-float) (constant (+ROOT4-FLT-EPSILON+ "GSL_ROOT4_FLT_EPSILON") :type double-float) (constant (+ROOT5-FLT-EPSILON+ "GSL_ROOT5_FLT_EPSILON") :type double-float) (constant (+ROOT6-FLT-EPSILON+ "GSL_ROOT6_FLT_EPSILON") :type double-float) (constant (+LOG-FLT-EPSILON+ "GSL_LOG_FLT_EPSILON") :type double-float) (constant (+FLT-MIN+ "GSL_FLT_MIN") :type double-float) (constant (+SQRT-FLT-MIN+ "GSL_SQRT_FLT_MIN") :type double-float) (constant (+ROOT3-FLT-MIN+ "GSL_ROOT3_FLT_MIN") :type double-float) (constant (+ROOT4-FLT-MIN+ "GSL_ROOT4_FLT_MIN") :type double-float) (constant (+ROOT5-FLT-MIN+ "GSL_ROOT5_FLT_MIN") :type double-float) (constant (+ROOT6-FLT-MIN+ "GSL_ROOT6_FLT_MIN") :type double-float) (constant (+LOG-FLT-MIN+ "GSL_LOG_FLT_MIN") :type double-float) (constant (+FLT-MAX+ "GSL_FLT_MAX") :type double-float) (constant (+SQRT-FLT-MAX+ "GSL_SQRT_FLT_MAX") :type double-float) (constant (+ROOT3-FLT-MAX+ "GSL_ROOT3_FLT_MAX") :type double-float) (constant (+ROOT4-FLT-MAX+ "GSL_ROOT4_FLT_MAX") :type double-float) (constant (+ROOT5-FLT-MAX+ "GSL_ROOT5_FLT_MAX") :type double-float) (constant (+ROOT6-FLT-MAX+ "GSL_ROOT6_FLT_MAX") :type double-float) (constant (+LOG-FLT-MAX+ "GSL_LOG_FLT_MAX") :type double-float) (constant (+SFLT-EPSILON+ "GSL_SFLT_EPSILON") :type double-float) (constant (+SQRT-SFLT-EPSILON+ "GSL_SQRT_SFLT_EPSILON") :type double-float) (constant (+ROOT3-SFLT-EPSILON+ "GSL_ROOT3_SFLT_EPSILON") :type double-float) (constant (+ROOT4-SFLT-EPSILON+ "GSL_ROOT4_SFLT_EPSILON") :type double-float) (constant (+ROOT5-SFLT-EPSILON+ "GSL_ROOT5_SFLT_EPSILON") :type double-float) (constant (+ROOT6-SFLT-EPSILON+ "GSL_ROOT6_SFLT_EPSILON") :type double-float) (constant (+LOG-SFLT-EPSILON+ "GSL_LOG_SFLT_EPSILON") :type double-float) (constant (+SQRT-MACH-EPS+ "GSL_SQRT_MACH_EPS") :type double-float) (constant (+ROOT3-MACH-EPS+ "GSL_ROOT3_MACH_EPS") :type double-float) (constant (+ROOT4-MACH-EPS+ "GSL_ROOT4_MACH_EPS") :type double-float) (constant (+ROOT5-MACH-EPS+ "GSL_ROOT5_MACH_EPS") :type double-float) (constant (+ROOT6-MACH-EPS+ "GSL_ROOT6_MACH_EPS") :type double-float) (constant (+LOG-MACH-EPS+ "GSL_LOG_MACH_EPS") :type double-float)