blib/lib/PerlGSL.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package PerlGSL;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 our $VERSION = '0.002';
7 $VERSION = eval $VERSION;
8  
9 1 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 our %EXPORT_TAGS;
12 our @EXPORT_OK;
13  
14 BEGIN {
15 0 ▶ if ( eval { use PerlGSL::DiffEq 0.08 qw/ode_solver/; 1; } ) {
Subroutine BEGIN: called CC=1 SCAR=2.6
16 $EXPORT_TAGS{'diffeq'} = [ qw/ode_solver/ ];
17 }
18 }
19  
20 use PerlGSL::Integration::SingleDim 0.002 qw/int_1d/;
21 use PerlGSL::Integration::MultiDim 0.003 qw/int_multi/;
22 $EXPORT_TAGS{'integration'} = [ qw/int_1d int_multi/ ];
23  
24 use PerlGSL::RootFinding::SingleDim 0.001 qw/findroot_1d/;
25 $EXPORT_TAGS{'root_finding'} = [ qw/findroot_1d/ ];
26  
27 push @EXPORT_OK, @$_ for values %EXPORT_TAGS;
28 $EXPORT_TAGS{'all'} = \@EXPORT_OK;
29  
30 1;
31  
32  
33 =head1 NAME
34  
35 PerlGSL - A Collection of Perlish Interfaces to the Gnu Scientific Library
36  
37 =head1 SYNOPSIS
38  
39 =head1 DESCRIPTION
40  
41 L<PerlGSL> defines both a namespace (with certain goals) and a distribution. The aim is to flexibly and modularly provide the GSL to Perl.
42  
43 =head1 PerlGSL: The Namespace
44  
45 C<PerlGSL> is primarily a concept, a namespace in which to put Perlish interfaces to the Gnu Scientific Library. The GSL provides a large number of C routines for doing scientific/mathematical calculations. To use the GSL from Perl you need to use a I<glue> module which interfaces Perl with the GSL. Perl/C interfaces can come in many flavors; some feel more like C (see L<Math::GSL>) while others strive to feel more like Perl. C<PerlGSL> is meant to be a namespace to collect such modules.
46  
47 Authors are encouraged to upload your modules to the C<PerlGSL> namespace. For consistency, please attempt to:
48  
49 =over
50  
51 =item *
52  
53 Use a functional formalism if possible
54  
55 =item *
56  
57 Think of mathematical functions as Perl closures if possible
58  
59 =item *
60  
61 Wrap your C level functions in Perl level functions for easier argument munging in the future
62  
63 =item *
64  
65 Choose your module's name with care and consideration for future authors
66  
67 =item *
68  
69 Don't use the name of the library as the name of your module. Using these names may make it hard for others to name interfaces to the same library. Unfortunately, this may be unavoidable in some cases. In other cases, the library name may be used by central modules to farm out computations to other modules. For example a L<PerlGSL::Integration> library is planned which will smartly farm out integration to the most appropriate solver (by dimensionality and complexity).
70  
71 =item *
72  
73 Be sane
74  
75 =back
76  
77 =head1 PerlGSL: The Standard Distribution
78  
79 Beyond defining a namespace, the C<PerlGSL> module is a central module for installing/loading the "Standard" PerlGSL modules. Installing L<PerlGSL> will install all of the following modules. Loading L<PerlGSL> does nothing, however loading with a tag (e.g. C<use PerlGSL ':tag';>) will import certain functions from these modules; the number in square brackets indicated the C<PerlGSL> version number that the module was added to the standard distribution. Those tags are:
80  
81 =over
82  
83 =item integration
84  
85 =over
86  
87 =item *
88  
89 C<int_1d> - from L<PerlGSL::Integration::SingleDim> [since 0.001]
90  
91 =item *
92  
93 C<int_multi> - from L<PerlGSL::Integration::MultiDim> [since 0.001]
94  
95 =back
96  
97 =item root_finding
98  
99 =over
100  
101 =item *
102  
103 C<findroot_1d> - from L<PerlGSL::RootFinding::SingleDim> [since 0.002]
104  
105 =back
106  
107 =item diffeq
108  
109 =over
110  
111 =item *
112  
113 C<ode_solver> - from L<PerlGSL::DiffEq> [since 0.001; requires GSL >= 1.15]
114  
115 =back
116  
117 =item all
118  
119 loads all of the above functions.
120  
121 =back
122  
123 Note also that any of the individual functions may be imported individully by name.
124  
125 If you are an author and would like your module added to this central framework please file a GitHub issue.
126  
127 =head1 Future Goals
128  
129 =over
130  
131 =item *
132  
133 Integrate L<PerlGSL> with L<Alien> to provide the GSL library via CPAN
134  
135 =item *
136  
137 Continue to add modules to the namespace and the "Stardard Distribution", eventually forming a well rounded GSL implementation.
138  
139 =back
140  
141 =head1 Other Perl GSL Bindings
142  
143 L<PerlGSL> is by no means the only bindings for GSL available via CPAN. Its purpose is to feel Perlish, as such it is slower than a C-level binding set and it is only as complete as authors have provided. Other bindings have other strengths and weaknesses.
144  
145 =over
146  
147 =item *
148  
149 L<PDL::GSL|http://pdl.perl.org/?docs=Modules&title=PDL::Modules#gnu_scientific_library> - L<PDL> is a C-level matrix-like sublanguage for Perl. It is in the vein of MatLab or IDL. It has bindings to many of the GSL libraries. It is fast, but only as Perlish as PDL is itself.
150  
151 =item *
152  
153 L<Math::GSL> - This set of bindings is generated by L<SWIG|http://www.swig.org/>; it is therefore ostensibly complete, though this is only partially true. Many modules will still need some massaging before they are functional. Even those that are may feel more like C than Perl.
154  
155 =back
156  
157 =head1 SOURCE REPOSITORY
158  
159 L<http://github.com/jberger/PerlGSL>
160  
161 =head1 AUTHOR
162  
163 Joel Berger, E<lt>joel.a.berger@gmail.comE<gt>
164  
165 =head1 COPYRIGHT AND LICENSE
166  
167 Copyright (C) 2012 by Joel Berger
168  
169 This library is free software; you can redistribute it and/or modify
170 it under the same terms as Perl itself.
171  
172 The GSL is licensed under the terms of the GNU General Public License (GPL)
173  
↑ Summary