| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::RecordStream::Aggregator::Covariance; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | our $VERSION = "4.0.25"; | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 6 |  |  | 6 |  | 77369 | use strict; | 
|  | 6 |  |  |  |  | 33 |  | 
|  | 6 |  |  |  |  | 163 |  | 
| 6 | 6 |  |  | 6 |  | 34 | use warnings; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 187 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 6 |  |  | 6 |  | 554 | use App::RecordStream::Aggregator::Ord2Bivariate; | 
|  | 6 |  |  |  |  | 14 |  | 
|  | 6 |  |  |  |  | 142 |  | 
| 9 | 6 |  |  | 6 |  | 33 | use App::RecordStream::Aggregator; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 140 |  | 
| 10 | 6 |  |  | 6 |  | 419 | use App::RecordStream::DomainLanguage::Registry; | 
|  | 6 |  |  |  |  | 13 |  | 
|  | 6 |  |  |  |  | 160 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 6 |  |  | 6 |  | 31 | use base 'App::RecordStream::Aggregator::Ord2Bivariate'; | 
|  | 6 |  |  |  |  | 81 |  | 
|  | 6 |  |  |  |  | 1515 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | #sub new -- passed through | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | #sub new_from_valuation -- passed through | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub squish | 
| 19 |  |  |  |  |  |  | { | 
| 20 | 10 |  |  | 10 | 0 | 29 | my ($this, $cookie) = @_; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 10 |  |  |  |  | 19 | my ($sum1, $sumx, $sumy, $sumxy, $sumx2, $sumy2) = @$cookie; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 10 |  |  |  |  | 46 | return ($sumxy / $sum1) - ($sumx / $sum1) * ($sumy / $sum1); | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | sub long_usage | 
| 28 |  |  |  |  |  |  | { | 
| 29 | 0 |  |  | 0 | 0 |  | return < | 
| 30 |  |  |  |  |  |  | Usage: cov,, | 
| 31 |  |  |  |  |  |  | Covariance of specified fields. | 
| 32 |  |  |  |  |  |  | EOF | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | sub short_usage | 
| 36 |  |  |  |  |  |  | { | 
| 37 | 0 |  |  | 0 | 0 |  | return "find covariance of provided fields"; | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | App::RecordStream::Aggregator->register_implementation('cov', __PACKAGE__); | 
| 41 |  |  |  |  |  |  | App::RecordStream::Aggregator->register_implementation('covar', __PACKAGE__); | 
| 42 |  |  |  |  |  |  | App::RecordStream::Aggregator->register_implementation('covariance', __PACKAGE__); | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'cov', 'VALUATION', 'VALUATION'); | 
| 45 |  |  |  |  |  |  | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'covar', 'VALUATION', 'VALUATION'); | 
| 46 |  |  |  |  |  |  | App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'covariance', 'VALUATION', 'VALUATION'); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | 1; |