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