| 1 | package Statistics::Descriptive::Smoother; | ||||||||||||||||||||||||||||
| 2 | 17 | $Statistics::Descriptive::Smoother::VERSION = '3.0801'; | |||||||||||||||||||||||||||
| 3 | 17 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 17 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 17 | ▶ | use Carp qw/ carp /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | ## no critic (ProhibitExplicitReturnUndef) | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | sub instantiate | ||||||||||||||||||||||||||||
| 11 | 16 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
instantiate: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 12 | 16 | my ( $class, $args ) = @_; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 16 | my $method = delete $args->{method}; | |||||||||||||||||||||||||||
| 15 | 16 | ▶ | my $coeff = delete $args->{coeff} || 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
delete $args->{'coeff'} || 0
MC/DC100%1/1
delete $args->{'coeff'} || 0
delete $args->{'coeff'}
Truth table100%2/2
A
A= delete $args->{'coeff'}
| |||||||||||||||||||||||||||||
| 16 | 16 | my $ra_samples = delete $args->{samples}; | |||||||||||||||||||||||||||
| 17 | 16 | my $ra_data = delete $args->{data}; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 16 | ▶ | if ( $coeff < 0 || $coeff > 1 ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$coeff < 0 or $coeff > 1
MC/DC100%2/2
$coeff < 0 or $coeff > 1
$coeff < 0
$coeff > 1
Truth table100%3/3
A or B
A= $coeff < 0B= $coeff > 1
| |||||||||||||||||||||||||||||
| 20 | { | ||||||||||||||||||||||||||||
| 21 | 2 | carp("Invalid smoothing coefficient C $coeff\n"); | |||||||||||||||||||||||||||
| 22 | 2 | return; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | 14 | ▶ | if ( @$ra_data < 2 ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | { | ||||||||||||||||||||||||||||
| 26 | 1 | carp("Need at least 2 samples to smooth the data\n"); | |||||||||||||||||||||||||||
| 27 | 1 | return; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | 13 | $method = ucfirst( lc($method) ); | |||||||||||||||||||||||||||
| 30 | 13 | my $sub_class = __PACKAGE__ . "::$method"; | |||||||||||||||||||||||||||
| 31 | ## no critic | ||||||||||||||||||||||||||||
| 32 | 13 | eval "require $sub_class"; | |||||||||||||||||||||||||||
| 33 | ## use critic | ||||||||||||||||||||||||||||
| 34 | 13 | ▶ | die "No such class $sub_class: $@" if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 12 | return $sub_class->_new( | |||||||||||||||||||||||||||
| 37 | { | ||||||||||||||||||||||||||||
| 38 | data => $ra_data, | ||||||||||||||||||||||||||||
| 39 | samples => $ra_samples, | ||||||||||||||||||||||||||||
| 40 | count => scalar @$ra_data, | ||||||||||||||||||||||||||||
| 41 | coeff => $coeff, | ||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 145 | ▶ | sub get_smoothing_coeff { $_[0]->{coeff} } | ||||||||||||||||||||||||||
|
Subroutine
get_smoothing_coeff: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub set_smoothing_coeff | ||||||||||||||||||||||||||||
| 49 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_smoothing_coeff: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 50 | 2 | my ( $self, $coeff ) = @_; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 2 | ▶ | if ( $coeff < 0 || $coeff > 1 ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$coeff < 0 or $coeff > 1
MC/DC50%1/2
$coeff < 0 or $coeff > 1
$coeff < 0
$coeff > 1
Truth table66%2/3
A or B
A= $coeff < 0B= $coeff > 1
| |||||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||
| 54 | 1 | carp("Invalid smoothing coefficient C $coeff\n"); | |||||||||||||||||||||||||||
| 55 | 1 | return; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 1 | $self->{coeff} = $coeff; | |||||||||||||||||||||||||||
| 59 | 1 | return 1; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 17 | 1; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | __END__ | ||||||||||||||||||||||||||||