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 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 our $VERSION = '0.02';
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 my ($p, $c, $z, $x, $m, $s); # intialize them
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 =for Pod::Coverage cdf inv_cdf pdf
63  
64 =head1 SOURCE CODE
65  
66 L<GitHub|https://github.com/binary-com/perl-Math-Gauss-XS>
67  
68  
69 =head1 AUTHOR
70  
71 binary.com, C<< <perl at binary.com> >>
72  
73 =head1 BUGS
74  
75 Please report any bugs or feature requests to
76 L<https://github.com/binary-com/perl-Math-Gauss-XS/issues>.
77  
78 =cut
79  
80 1;
« XS.xs ↑ Summary