blib/lib/Math/Gauss/XS.pm

filter: Statementstmt 100% 6 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 8 / 8 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« XS.xs ↑ Summary
1 package Math::Gauss::XS;
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 our $VERSION = '0.01';
6  
7 require Exporter;
8 our @ISA = qw( Exporter );
9 our %EXPORT_TAGS = ( 'all' => [qw( pdf cdf inv_cdf )] );
10 Exporter::export_ok_tags( 'all' );
11  
12 require XSLoader;
13 XSLoader::load('Math::Gauss::XS', $VERSION);
14  
15 =head1 NAME
16  
17 Math::Gauss::XS - Gaussian distribution function and its inverse, fast XS version
18  
19 =head1 VERSION
20  
21 0.01
22  
23 =head1 STATUS
24  
25 =begin HTML
26  
27 <p>
28 <a href="https://travis-ci.org/binary-com/perl-Math-Gauss-XS"><img src="https://travis-ci.org/binary-com/perl-Math-Gauss-XS.svg" /></a>
29 </p>
30  
31 =end HTML
32  
33 =head1 SYNOPSIS
34  
35 use Math::Gauss::XS ':all';
36  
37 $p = pdf( $z );
38 $p = pdf( $x, $m, $s );
39  
40 $c = cdf( $z );
41 $c = cdf( $x, $m, $s );
42  
43 $z = inv_cdf( $z );
44  
45 =head1 DESCRIPTION
46  
47 This module just rewrites the L<Math::Gauss> module in XS. The precision and
48 exported function remain the same as in the original.
49  
50 The benchmark results are
51  
52 Benchmark: timing 30000000 iterations of pp/pdf, xs/pdf...
53 pp/pdf: 15 wallclock secs (14.99 usr + 0.00 sys = 14.99 CPU) @ 2001334.22/s (n=30000000)
54 xs/pdf: 2 wallclock secs ( 2.16 usr + 0.00 sys = 2.16 CPU) @ 13888888.89/s (n=30000000)
55 Benchmark: timing 30000000 iterations of pp/cdf, xs/cdf...
56 pp/cdf: 40 wallclock secs (38.93 usr + 0.00 sys = 38.93 CPU) @ 770613.92/s (n=30000000)
57 xs/cdf: 2 wallclock secs ( 2.22 usr + 0.00 sys = 2.22 CPU) @ 13513513.51/s (n=30000000)
58 Benchmark: timing 30000000 iterations of pp/inv_cdf, xs/inv_cdf...
59 pp/inv_cdf: 15 wallclock secs (16.02 usr + 0.00 sys = 16.02 CPU) @ 1872659.18/s (n=30000000)
60 xs/inv_cdf: 2 wallclock secs ( 2.18 usr + 0.00 sys = 2.18 CPU) @ 13761467.89/s (n=30000000)
61  
62 =head1 SOURCE CODE
63  
64 L<GitHub|https://github.com/binary-com/perl-Math-Gauss-XS>
65  
66  
67 =head1 AUTHOR
68  
69 binary.com, C<< <perl at binary.com> >>
70  
71 =head1 BUGS
72  
73 Please report any bugs or feature requests to
74 L<https://github.com/binary-com/perl-Math-Gauss-XS/issues>.
75  
76 =head1 LICENSE AND COPYRIGHT
77  
78 Copyright (C) 2016 binary.com
79  
80 This program is free software; you can redistribute it and/or modify it
81 under the terms of the the Artistic License (2.0). You may obtain a
82 copy of the full license at:
83  
84 L<http://www.perlfoundation.org/artistic_license_2_0>
85  
86 Any use, modification, and distribution of the Standard or Modified
87 Versions is governed by this Artistic License. By using, modifying or
88 distributing the Package, you accept this license. Do not use, modify,
89 or distribute the Package, if you do not accept this license.
90  
91 If your Modified Version has been derived from a Modified Version made
92 by someone other than you, you are nevertheless required to ensure that
93 your Modified Version complies with the requirements of this license.
94  
95 This license does not grant you the right to use any trademark, service
96 mark, tradename, or logo of the Copyright Holder.
97  
98 This license includes the non-exclusive, worldwide, free-of-charge
99 patent license to make, have made, use, offer to sell, sell, import and
100 otherwise transfer the Package with respect to any patent claims
101 licensable by the Copyright Holder that are necessarily infringed by the
102 Package. If you institute patent litigation (including a cross-claim or
103 counterclaim) against any party alleging that the Package constitutes
104 direct or contributory patent infringement, then this Artistic License
105 to you shall terminate on the date that such litigation is filed.
106  
107 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
108 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
109 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
110 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
111 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
112 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
113 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
114 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
115  
116 =cut
117  
118  
119 1;
« XS.xs ↑ Summary