line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Statistics::Descriptive::Smoother::Exponential; |
2
|
|
|
|
|
|
|
$Statistics::Descriptive::Smoother::Exponential::VERSION = '3.0800'; |
3
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
76
|
|
4
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
73
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
682
|
use parent 'Statistics::Descriptive::Smoother'; |
|
3
|
|
|
|
|
474
|
|
|
3
|
|
|
|
|
15
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _new |
9
|
|
|
|
|
|
|
{ |
10
|
7
|
|
|
7
|
|
15
|
my ( $class, $args ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
7
|
|
50
|
|
|
30
|
return bless $args || {}, $class; |
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
|
|
|
|
|
|
|
{ |
18
|
4
|
|
|
4
|
1
|
26
|
my ($self) = @_; |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
7
|
my @smoothed_values; |
21
|
4
|
|
|
|
|
6
|
push @smoothed_values, @{ $self->{data} }[0]; |
|
4
|
|
|
|
|
17
|
|
22
|
4
|
|
|
|
|
16
|
my $C = $self->get_smoothing_coeff(); |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
|
|
11
|
foreach my $sample_idx ( 1 .. $self->{count} - 1 ) |
25
|
|
|
|
|
|
|
{ |
26
|
|
|
|
|
|
|
my $smoothed_value = $C * ( $smoothed_values[-1] ) + |
27
|
36
|
|
|
|
|
55
|
( 1 - $C ) * $self->{data}->[$sample_idx]; |
28
|
36
|
|
|
|
|
55
|
push @smoothed_values, $smoothed_value; |
29
|
|
|
|
|
|
|
} |
30
|
4
|
|
|
|
|
14
|
return @smoothed_values; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |