line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDL::NDBin::Action::Max; |
2
|
|
|
|
|
|
|
# ABSTRACT: Action for PDL::NDBin that computes maximum |
3
|
|
|
|
|
|
|
$PDL::NDBin::Action::Max::VERSION = '0.020'; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
2207
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
74
|
|
6
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
55
|
|
7
|
2
|
|
|
2
|
|
9
|
use PDL::Lite; # do not import any functions into this namespace |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
8
|
2
|
|
|
2
|
|
217
|
use PDL::NDBin::Actions_PP; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
15
|
|
9
|
2
|
|
|
2
|
|
299
|
use Params::Validate qw( validate OBJECT SCALAR UNDEF ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
630
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
44
|
|
|
44
|
1
|
10507
|
my $class = shift; |
15
|
44
|
|
|
|
|
794
|
my $self = validate( @_, { |
16
|
|
|
|
|
|
|
N => { type => SCALAR, regex => qr/^\d+$/ }, |
17
|
|
|
|
|
|
|
type => { type => OBJECT | UNDEF, isa => 'PDL::Type', optional => 1 } |
18
|
|
|
|
|
|
|
} ); |
19
|
44
|
|
|
|
|
925
|
return bless $self, $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub process |
24
|
|
|
|
|
|
|
{ |
25
|
56
|
|
|
56
|
1
|
115
|
my $self = shift; |
26
|
56
|
|
|
|
|
75
|
my $iter = shift; |
27
|
56
|
100
|
|
|
|
161
|
if( ! defined $self->{out} ) { |
28
|
44
|
100
|
|
|
|
147
|
my $type = defined $self->{type} ? $self->{type} : $iter->data->type; |
29
|
44
|
|
|
|
|
963
|
$self->{out} = PDL->zeroes( $type, $self->{N} )->setbadif( 1 ); |
30
|
|
|
|
|
|
|
} |
31
|
56
|
|
|
|
|
3438
|
PDL::NDBin::Actions_PP::_imax_loop( $iter->data, $iter->idx, $self->{out}, $self->{N} ); |
32
|
|
|
|
|
|
|
# as the plugin processes all bins at once, every variable |
33
|
|
|
|
|
|
|
# needs to be visited only once |
34
|
56
|
|
|
|
|
231
|
$iter->var_active( 0 ); |
35
|
56
|
|
|
|
|
168
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub result |
40
|
|
|
|
|
|
|
{ |
41
|
44
|
|
|
44
|
1
|
438
|
my $self = shift; |
42
|
44
|
|
|
|
|
205
|
return $self->{out}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |