X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fgsl-1.0.8%2Ftest_ellint.m;fp=octave_packages%2Fgsl-1.0.8%2Ftest_ellint.m;h=35eb50b3eb88b8226f65211b391914eac88c877b;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/gsl-1.0.8/test_ellint.m b/octave_packages/gsl-1.0.8/test_ellint.m new file mode 100644 index 0000000..35eb50b --- /dev/null +++ b/octave_packages/gsl-1.0.8/test_ellint.m @@ -0,0 +1,136 @@ +## Copyright (C) 2008 Raymond E. Rogers +## +## 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 +## 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 . + +# +# +# +# R. Rogers v1, testing gsl_sf_ellint_Kcomp_e, gsl_sf_ellint_Ecomp_e +# implementation in octave as ellint_Kcomp, ellint_Ecomp +# against the gsl tests +# Some array verification is done; since I messed it up once. + + +global GSL_DBL_EPSILON= 2.2204460492503131e-16 +global GSL_SQRT_DBL_EPSILON= 1.4901161193847656e-08 +global TEST_TOL0= (2.0*GSL_DBL_EPSILON) +global TEST_TOL1= (16.0*GSL_DBL_EPSILON) +global TEST_TOL2= (256.0*GSL_DBL_EPSILON) +global TEST_TOL3= (2048.0*GSL_DBL_EPSILON) +global TEST_TOL4= (16384.0*GSL_DBL_EPSILON) +global TEST_TOL5= (131072.0*GSL_DBL_EPSILON) +global TEST_TOL6= (1048576.0*GSL_DBL_EPSILON) +global TEST_SQRT_TOL0= (2.0*GSL_SQRT_DBL_EPSILON) +global TEST_SNGL= (1.0e-06) + +global TEST_SF_INCONS= 1 +global TEST_SF_ERRNEG= 2 +global TEST_SF_TOLBAD= 4 +global TEST_SF_RETBAD= 8 +global TEST_SF_ERRBAD= 16 +global TEST_SF_ERRBIG= 32 +global TEST_SF_EXPBAD= 64 +global TEST_FACTOR= 100 + + +function res=READ_TEST_SF_ellint(input_name) +global GSL_DBL_EPSILON +global GSL_SQRT_DBL_EPSILON +global TEST_TOL0 +global TEST_TOL1 +global TEST_TOL2 +global TEST_TOL3 +global TEST_TOL4 +global TEST_TOL5 +global TEST_TOL6 +global TEST_SQRT_TOL0 +global TEST_SNGL + +global TEST_SF_INCONS +global TEST_SF_ERRNEG +global TEST_SF_TOLBAD +global TEST_SF_RETBAD +global TEST_SF_ERRBAD +global TEST_SF_ERRBIG +global TEST_SF_EXPBAD + +global TEST_FACTOR + [source_id,source_msg]=fopen(input_name,"r","native") + + + while (! feof(source_id)) + do + input_line=fgetl(source_id); + until( index(input_line,"//") == 0); + + str_p=index(input_line,"gsl_sf_ellint_Kcomp_e"); + if (str_p != 0) + # Take it apart + string_split=char(strsplit(input_line,",")); + arg1=str2double(substr(string_split(3,:),3)); + arg2=str2double(string_split(4,:)); + arg3=(string_split(5,:)); + val=str2double(string_split(6,:)); + tol=eval(string_split(7,:)); + [ret,err]=ellint_Kcomp(arg1,arg2); + # This is to prevent extanious stops on some errors + if ret==NaN + ret=Inf + endif + if (abs((ret-val)/val)