line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDL::NDBin::Action::Min; |
2
|
|
|
|
|
|
|
# ABSTRACT: Action for PDL::NDBin that computes minimum |
3
|
|
|
|
|
|
|
$PDL::NDBin::Action::Min::VERSION = '0.019'; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1953
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
75
|
|
6
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
53
|
|
7
|
2
|
|
|
2
|
|
10
|
use PDL::Lite; # do not import any functions into this namespace |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
8
|
2
|
|
|
2
|
|
217
|
use PDL::NDBin::Actions_PP; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
9
|
2
|
|
|
2
|
|
305
|
use Params::Validate qw( validate OBJECT SCALAR UNDEF ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
625
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new |
13
|
|
|
|
|
|
|
{ |
14
|
44
|
|
|
44
|
1
|
10705
|
my $class = shift; |
15
|
44
|
|
|
|
|
788
|
my $self = validate( @_, { |
16
|
|
|
|
|
|
|
N => { type => SCALAR, regex => qr/^\d+$/ }, |
17
|
|
|
|
|
|
|
type => { type => OBJECT | UNDEF, isa => 'PDL::Type', optional => 1 } |
18
|
|
|
|
|
|
|
} ); |
19
|
44
|
|
|
|
|
938
|
return bless $self, $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub process |
24
|
|
|
|
|
|
|
{ |
25
|
56
|
|
|
56
|
1
|
114
|
my $self = shift; |
26
|
56
|
|
|
|
|
87
|
my $iter = shift; |
27
|
56
|
100
|
|
|
|
157
|
if( ! defined $self->{out} ) { |
28
|
44
|
100
|
|
|
|
162
|
my $type = defined $self->{type} ? $self->{type} : $iter->data->type; |
29
|
44
|
|
|
|
|
992
|
$self->{out} = PDL->zeroes( $type, $self->{N} )->setbadif( 1 ); |
30
|
|
|
|
|
|
|
} |
31
|
56
|
|
|
|
|
3362
|
PDL::NDBin::Actions_PP::_imin_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
|
|
|
|
|
197
|
$iter->var_active( 0 ); |
35
|
56
|
|
|
|
|
175
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub result |
40
|
|
|
|
|
|
|
{ |
41
|
44
|
|
|
44
|
1
|
448
|
my $self = shift; |
42
|
44
|
|
|
|
|
149
|
return $self->{out}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |