| 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 || {}
MC/DC0%0/1
$args || {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||
| 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__ | ||||||||||||