blib/lib/PDL/Constants.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 34 / 34 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/PDL/Doc/Config.pm ↑ Summary blib/lib/PDL/Fit/Gaussian.pm »
1 =head1 NAME
2  
3 PDL::Constants -- basic compile time constants for PDL
4  
5 =head1 DESCRIPTION
6  
7 This module is used to define compile time constant
8 values for PDL. It uses the constant module for
9 simplicity and availability. We'll need to sort
10 out exactly which constants make sense but PI and
11 E seem to be fundamental.
12  
13 =head1 SYNOPSIS
14  
15 use PDL::Constants qw(PI E);
16 print 'PI is ' . PI . "\n";
17 print 'E is ' . E . "\n";
18  
19 =cut
20  
21 package PDL::Constants;
22 2 our $VERSION = "0.02";
23 2 $VERSION = eval $VERSION;
24  
25 2 require Exporter;
26 2 @ISA = qw(Exporter);
27 2 @EXPORT_OK = qw(PI E I J); # symbols to export
28  
29 2 ▶use PDL::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 2 ▶use PDL::Complex qw(i);
Subroutine BEGIN: called CC=1 SCAR=0.0
31
32 =head2 PI
33  
34 The ratio of a circle's circumference to its diameter
35  
36 =cut
37  
38 2 ▶use constant PI => 4 * atan2(1, 1);
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 =head2 DEGRAD
41  
42 The The number of degrees of arc per radian (180/PI)
43  
44 =cut
45  
46 2 ▶use constant DEGRAD => 180/PI;
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 =head2 E
49  
50 The base of the natural logarithms or Euler's number
51  
52 =cut
53  
54 2 ▶use constant E => exp(1);
Subroutine BEGIN: called CC=1 SCAR=0.0
55  
56 =head2 I
57  
58 The imaginary unit, C< I*I == -1 >
59  
60 =cut
61  
62 2 ▶use constant I => i;
Subroutine BEGIN: called CC=1 SCAR=0.0
63  
64 =head2 J
65  
66 The imaginary unit for engineers, C< J*J == -1 >
67  
68 =cut
69  
70 2 ▶use constant J => i;
Subroutine BEGIN: called CC=1 SCAR=0.0
71  
72 =head1 COPYRIGHT & LICENSE
73  
74 Copyright 2010 Chris Marshall (chm at cpan dot org).
75  
76 This program is free software; you can redistribute it and/or modify it
77 under the terms of either: the GNU General Public License as published
78 by the Free Software Foundation; or the Artistic License.
79  
80 See http://dev.perl.org/licenses/ for more information.
81  
82 =cut
83  
84 2 1;
« blib/lib/PDL/Doc/Config.pm ↑ Summary blib/lib/PDL/Fit/Gaussian.pm »