Basic/StdDev.pm

filter: Statementstmt 100% 33 / 33 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 90.3% 47 / 52 CC 6 SCAR 9.3
CC
6
Cov
88%
new
4.1
_recalc
3.0
BEGIN
1.0
CRAP 2.5
« Basic.pm ↑ Summary Basic/ComputedVector.pm »
1  
2 package Statistics::Basic::StdDev;
3  
4 33 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 33 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 33 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 33 ▶use base 'Statistics::Basic::_OneVectorBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 36 ▶sub new {
Subroutine new: called CC=4 SCAR=14.1
Pod documented
11 36 my $class = shift;
12  
13 36 ▶ warn "[new $class]\n" if $Statistics::Basic::DEBUG >= 2;
Branch: 1 branch
BranchTrueFalseTotal
if $Statistics::Basic::DEBUG >= 2 0 36 36
14  
15 36 my $this = bless {}, $class;
16 36 ▶ my $variance = $this->{V} = eval { Statistics::Basic::Variance->new(@_) } or croak $@;
Branch: 1 branch
BranchTrueFalseTotal
my $variance = $this->{"V"} = eval { do { "Statistics::Basic::Variance"->new(@_) } } or croak($@) 36 0 36
17 36 my $vector = $this->{v} = $variance->query_vector;
18 36 ▶ my $c = $vector->_get_computer( 'stddev' ); return $c if defined $c;
Branch: 1 branch
BranchTrueFalseTotal
if defined $c 0 36 36
19  
20 36 $vector->_set_computer( stddev => $this );
21  
22 36 return $this;
23 }
24  
25 53 ▶sub _recalc {
Subroutine _recalc: called CC=3 SCAR=11.1
26 53 my $this = shift;
27 53 my $first = shift;
28  
29 53 delete $this->{recalc_needed};
30  
31 53 my $var = $this->{V}->query;
32 53 ▶ return unless defined $var;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $var 0 53 53
33 # no need to query filled here, variance does it for us
34  
35 53 ▶ warn "[recalc " . ref($this) . "] sqrt( $var )\n" if $Statistics::Basic::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Statistics::Basic::DEBUG 0 53 53
36  
37 53 $this->{_value} = sqrt( $var );
38  
39 53 return;
40 }
41  
42 1 ▶sub query_mean {
Subroutine query_mean: called CC=1 SCAR=0.0
Pod documented
43 1 my $this = shift;
44  
45 1 return $this->{V}->query_mean;
46 }
47  
48 33 1;
« Basic.pm ↑ Summary Basic/ComputedVector.pm »