4 use Math
::GSL
::Machine qw
/:all/;
5 use Math
::GSL
::Const qw
/:all/;
9 use Scalar
::Util qw
/looks_like_number/;
12 our @ISA = qw(Exporter DynaLoader);
14 our @EXPORT_OK = qw( is_similar );
15 use constant MAX_DOUBLE
=> 1.7976931348623157e+308;
16 use constant MIN_DOUBLE
=> 2.2250738585072014e-308;
17 use constant MAX_FLOAT
=> 3.40282347e+38;
18 use constant MIN_FLOAT
=> 1.175494351e-38;
23 Math::GSL - Perl interface to the GNU Scientific Library (GSL) using SWIG
33 use Math::GSL::RNG qw/:all/;
38 Jonathan Leto, C<< <jonathan@leto.net> >> and Thierry Moisan C<< <thierry.moisan@gmail.com> >>
42 Please report any bugs or feature requests to the authors directly.
47 You can find documentation for this module with the perldoc command.
51 or online at L<http://leto.net/code/Math-GSL/>
55 =item * AnnoCPAN: Annotated CPAN documentation
57 L<http://annocpan.org/dist/Math::GSL>
61 L<http://cpanratings.perl.org/d/Math::GSL>
65 L<http://search.cpan.org/dist/Math::GSL>
70 =head1 ACKNOWLEDGEMENTS
73 =head1 COPYRIGHT & LICENSE
75 Copyright 2008 Jonathan Leto, Thierry Moisan all rights reserved.
77 This program is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.
84 my ($self,$args) = @_;
85 my $class = ref $self || $self || 'Math::GSL';
93 BLAS Diff Machine Permute Statistics
94 Block Eigen Matrix Poly Sum
95 BSpline Errno PowInt Sys
96 CBLAS FFT Min IEEEUtils
97 CDF Fit Mode QRNG Types
98 Chebyshev Function Monte RNG Vector
99 Heapsort Multifit Randist
100 Combination Histogram Multimin Roots Wavelet
101 Complex Histogram2d Multiroots SF Wavelet2D
103 DFT Integration NTuple Sort
105 Deriv Linalg Permutation Spline
111 my ($self,$results,$class) = @_;
114 while (my($k,$v)=each %$results){
115 my $eps = 2048*$Math::GSL
::Machine
::GSL_DBL_EPSILON
; # TOL3
117 defined $class ?
( $x = eval qq{${class}::$k} )
121 print "got $x for $k\n" if defined $ENV{DEBUG
};
123 if (ref $v eq 'ARRAY'){
129 ok
(0, qq{'$k' died
} );
130 } elsif ($x =~ /nan|inf/i){
131 ok
( $val eq $x, "'$v'?='$x'" );
133 my $res = abs($x-$val);
135 : ok
( $res <= $eps, "$k ?= $x,\n+- $res, tol=$eps" );
141 my ($x,$y, $eps) = @_;
143 abs($x-$y) < $eps ?
1 : 0;
149 return 0 unless ( defined $x && looks_like_number
($x) );
151 return 1 if ($x == 0);
162 return 0 unless ( defined $x && looks_like_number
($x) );
164 return 1 if ($x == 0);
173 sub _has_quads
{ $Config{use64bitint
} eq 'define' || ($Config{longsize
} >= 8) }
174 sub _has_long_doubles
{ $Config{d_longdbl
} eq 'define' }
175 sub _has_long_doubles_as_default
{ $Config{uselongdouble
} eq 'define' }
176 sub _has_long_doubles_same_as_doubles
{ $Config{doublesize
} == $Config{longdblsize
} }
178 sub _assert_dies
($;$)
180 my ($code,$msg) = @_;
181 my $status = eval { &$code };
182 print "status=||$status||\n\$\?=$?\n\$\!=$!\n" if 0;
183 $@ ? ok
(1, $msg) : ok
(0, join "\n", $@
, $msg );