Fix POD
[Math-GSL.git] / lib / Math / GSL.pm
blob6b49c7abf05f4dc34d8a0e7e3ede80544b792fc0
1 package Math::GSL;
2 use base qw(Exporter);
3 use base qw(DynaLoader);
4 use strict;
5 use warnings;
6 use Math::GSL::Machine qw/:all/;
7 use Math::GSL::Const qw/:all/;
8 use Math::GSL::Errno qw/:all/;
9 use Math::GSL::Vector qw/:file/;
10 use Math::GSL::Test qw/:all/;
11 use Carp qw/croak/;
12 use Config;
13 use Test::More;
14 our @EXPORT = qw();
15 our @EXPORT_OK = qw(
16 gsl_inf gsl_fopen gsl_fclose gsl_nan
17 $GSL_MODE_DEFAULT $GSL_PREC_DOUBLE
18 $GSL_PREC_SINGLE $GSL_PREC_APPROX
21 our %EXPORT_TAGS = (
22 all => \@EXPORT_OK,
25 our ($GSL_PREC_DOUBLE, $GSL_PREC_SINGLE, $GSL_PREC_APPROX ) = 0..2;
26 our $GSL_MODE_DEFAULT = $GSL_PREC_DOUBLE;
27 our $VERSION = '0.11_01';
30 =head1 NAME
32 Math::GSL - Perl interface to the GNU Scientific Library (GSL)
34 =head1 VERSION
36 Version 0.11_01
38 =cut
40 =head1 SYNOPSIS
42 use Math::GSL::Matrix qw/:all/;
43 my $matrix = Math::GSL::Matrix->new(5,5); # 5x5 zero matrix
44 $matrix->set_col(0, [1..5])
45 ->set_row(2, [5..9]);
46 my @matrix = $matrix->as_list; # matrix as Perl list
47 my $gsl_matrix = $matrix->raw; # underlying GSL object
49 Each GSL subsystem has it's own module. For example, the random number generator
50 subsystem is Math::GSL::RNG. Many subsystems have a more Perlish and
51 object-oriented frontend which can be used, as the above example shows. The raw
52 GSL object is useful for using the low-level GSL functions, which in the case of
53 the Matrix subsytem, would be of the form gsl_matrix_* . Each module has further
54 documentation about the low-level C functions as well as using the more
55 intuitive (but slightly slower) object-oriented interface.
57 =head1 SUBSYSTEMS
59 Math::GSL::BLAS - Linear Algebra Functions
60 Math::GSL::BSpline - BSplines
61 Math::GSL::CBLAS - Linear Algebra Functions
62 Math::GSL::CDF - Cumulative Distribution Functions
63 Math::GSL::Chebyshev - Chebyshev Polynomials
64 Math::GSL::Combination - Combinatoric Functions
65 Math::GSL::Complex - Complex Numbers
66 Math::GSL::Const - Various Constants
67 Math::GSL::DHT - Discrete Hilbert Transform
68 Math::GSL::Deriv - Numerical Derivative
69 Math::GSL::Eigen - Eigenvalues and Eigenvectors
70 Math::GSL::Errno - Error Handling
71 Math::GSL::FFT - Fast Fourier Transform
72 Math::GSL::Fit - Curve Fitting
73 Math::GSL::Heapsort - Sorting Heaps
74 Math::GSL::Histogram - Histograms
75 Math::GSL::Histogram2D - 2D Histograms
76 Math::GSL::Integration - Numerical Integration
77 Math::GSL::Interp - Interpolation
78 Math::GSL::Linalg - Linear Algebra
79 Math::GSL::Machine - Machine Specific Information
80 Math::GSL::Matrix - NxM Matrices
81 Math::GSL::Min - Minimization
82 Math::GSL::Monte - Monte Carlo Integrations
83 Math::GSL::Multifit - Multivariable Fitting
84 Math::GSL::Multimin - Multivariable Minimization
85 Math::GSL::Multiroots - Muiltvariable Root Finding
86 Math::GSL::NTuple - N Tuples
87 Math::GSL::ODEIV - Ordinary Differential Equation Solvers (Initial Value Problems)
88 Math::GSL::Permutation - Permutations
89 Math::GSL::Poly - Polynmials
90 Math::GSL::PowInt - Integer Power Functions
91 Math::GSL::QRNG - Quasi-Random Number Generators
92 Math::GSL::RNG - Random Number Generators
93 Math::GSL::Randist - Random Number Distributions
94 Math::GSL::Roots - Root Finding Algorithms
95 Math::GSL::SF - Special Functions
96 Math::GSL::Siman - Simulated Annealing
97 Math::GSL::Sort - Sorting
98 Math::GSL::Spline - Splines
99 Math::GSL::Statistics - Statistics Functions
100 Math::GSL::Sum - Summation
101 Math::GSL::Sys - Sytem utility functions
102 Math::GSL::Vector - N-dimensional Vectors
103 Math::GSL::Wavelet - Basic Wavelets
104 Math::GSL::Wavelet2D - 2D Wavelets
107 =head1 AUTHORS
109 Jonathan Leto, C<< <jonathan@leto.net> >> and Thierry Moisan C<< <thierry.moisan@gmail.com> >>
111 =head1 BUGS
113 This software is still in active development, we appreciate your detailed bug reports and
114 documentation patches. Please report any bugs or feature requests to the authors directly.
117 =head1 SUPPORT
119 You can find documentation for this module with the perldoc command.
121 perldoc Math::GSL
123 or online at L<http://leto.net/code/Math-GSL/>
125 =over 4
127 =item * AnnoCPAN: Annotated CPAN documentation
129 L<http://annocpan.org/dist/Math::GSL>
131 =item * CPAN Ratings
133 L<http://cpanratings.perl.org/d/Math::GSL>
135 =item * Search CPAN
137 L<http://search.cpan.org/dist/Math::GSL>
139 =back
141 =head1 DEVELOPMENT
143 If you would like the help develop Math::GSL, email the authors
144 and do
146 git clone http://leto.net/code/Math-GSL.git
147 cd Math-GSL
148 git checkout -b bleed # create new local branch
149 git pull origin bleed # pull in remote bleed
151 to get the latest source, which is a two-headed beast with branches master and
152 bleed. The master branch is our stable branch, which is periodically sync-ed
153 with bleed. To view the latest source code online, go to
154 L<http://leto.net/gitweb/>. The latest version of Git can be found at
155 L<http://git.or.cz>.
157 =head1 ACKNOWLEDGEMENTS
159 Thanks to PDX.pm, The Perl Foundation and everyone at Google who makes
160 the Summer of Code happen each year. You rock.
162 =head1 DEDICATION
164 This Perl module is dedicated in memory of Nick Ing-Simmons.
166 =head1 COPYRIGHT & LICENSE
168 Copyright 2008 Jonathan Leto, Thierry Moisan all rights reserved.
170 This program is free software; you can redistribute it and/or modify it
171 under the same terms as Perl itself.
173 =cut
175 sub new
177 my ($self,$args) = @_;
178 my $class = ref $self || $self || 'Math::GSL';
179 my $this = { };
180 bless $this, $class;
183 sub subsystems
185 return sort qw/
186 Diff Machine Statistics
187 Eigen Matrix Poly
188 BSpline Errno PowInt
189 CBLAS FFT Min IEEEUtils
190 CDF Fit QRNG
191 Chebyshev Monte RNG Vector
192 Heapsort Multifit Randist Roots
193 Combination Histogram Multimin Wavelet
194 Complex Histogram2D Multiroots Wavelet2D
195 Const Siman Sum Sys
196 NTuple Integration Sort Test
197 DHT Interp ODEIV SF
198 Deriv Linalg Permutation Spline
201 sub gsl_inf
203 is_windows() ? unpack 'd', scalar reverse pack 'H*', '7FF0000000000000'
204 : q{inf}
206 sub gsl_nan
208 is_windows() ? unpack 'd', scalar reverse pack 'H*', '7FF8000000000000'
209 : q{nan}
211 sub gsl_fopen
213 my ($file, $mode) = @_;
214 $mode .= '+b' if (is_windows() and $mode !~ /\+b/);
215 return Math::GSL::Vector::fopen($file, $mode);
218 sub gsl_fclose
220 my $file = shift;
221 return Math::GSL::Vector::fclose($file);