Descriptive/Smoother/Exponential.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 93.5% 29 / 31 CC 3 SCAR 4.6
CC
3
Cov
96%
_new
2.1
get_smoothed_data
2.0
BEGIN
1.0
CRAP 1.6
« Descriptive/Smoother/Weightedexponential.pm ↑ Summary Descriptive.pm »
1 package Statistics::Descriptive::Smoother::Exponential;
2 4 $Statistics::Descriptive::Smoother::Exponential::VERSION = '3.0801';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use parent 'Statistics::Descriptive::Smoother';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub _new
9 7 ▶{
Subroutine _new: called CC=2 SCAR=7.2
10 7 my ( $class, $args ) = @_;
11  
12 7 ▶ return bless $args || {}, $class;
Condition50%1/2
$args || {}
l!l
70
MC/DC0%0/1
$args || {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
13 }
14  
15 # The name of the variables used in the code refers to the explanation in the pod
16 sub get_smoothed_data
17 4 ▶{
Subroutine get_smoothed_data: called CC=2 SCAR=6.9
Pod documented
18 4 my ($self) = @_;
19  
20 4 my @smoothed_values;
21 4 push @smoothed_values, @{ $self->{data} }[0];
22 4 my $C = $self->get_smoothing_coeff();
23  
24 4 foreach my $sample_idx ( 1 .. $self->{count} - 1 )
25 {
26 my $smoothed_value = $C * ( $smoothed_values[-1] ) +
27 36 ( 1 - $C ) * $self->{data}->[$sample_idx];
28 36 push @smoothed_values, $smoothed_value;
29 }
30 4 return @smoothed_values;
31 }
32  
33 4 1;
34  
35 __END__
« Descriptive/Smoother/Weightedexponential.pm ↑ Summary Descriptive.pm »