blib/lib/PDL/PP/Signature.pm

filter: Statementstmt 97.0% 196 / 202 Branchbran 83.8% 57 / 68 Conditioncond 75.7% 50 / 66 MC/DCmcdc 47.5% 19 / 40 Subroutinesub 97.4% 38 / 39 Podpod 0.0% 0 / 32 totaltotal 80.5% 360 / 447 CC 68 SCAR 20.4
CC
68
Cov
90%
_validate
15.0
_otherPars_nft
15.0
othernames
11.2
CRAP 7.7
« blib/lib/PDL/Parallel/threads/SIMD.pm ↑ Summary blib/lib/PDL/IO/Dumper.pm »
1 package # hide from PAUSE/MetaCPAN
2 PDL::PP::Signature;
3  
4 6 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use PDL::PP::PdlParObj;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use PDL::PP::Dims;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 PDL::PP::Signature - Internal module to handle signatures
12  
13 =head1 DESCRIPTION
14  
15 Internal module to handle signatures
16  
17 =head1 SYNOPSIS
18  
19 use PDL::PP::Signature;
20  
21 =cut
22  
23 # Eliminate whitespace entries
24 471 ▶sub nospacesplit {grep /\S/, split $_[0],$_[1]}
Subroutine nospacesplit: called CC=1 SCAR=0.0
Pod undocumented
25  
26 236 ▶sub new {
Subroutine new: called CC=8 SCAR=20.8
Pod undocumented
27 236 my ($type,$pars,$opname,$otherpars,$otherparsdefaults,$argorder) = @_;
28 236 ▶ confess "$opname ArgOrder given defined but false value" if defined $argorder and !$argorder;
Branch: 1 branch
BranchTrueFalseTotal
if defined $argorder and not $argorder 0 236 236
Condition66%2/3
defined $argorder and not $argorder
!ll&&!rl&&r
224120
MC/DC0%0/2
defined $argorder and not $argorder
defined $argorder not $argorder
Truth table66%2/3
A and not(B)
A= defined $argorderB= not $argorder
ABresult
0X0
100
111
29 236 my @objects = map PDL::PP::PdlParObj->new($_, $opname), nospacesplit ';',$pars;
30 235 ▶ my $this = bless {
Condition100%2/2
$otherparsdefaults || {}
l!l
12223
MC/DC100%1/1
$otherparsdefaults || {}
$otherparsdefaults
Truth table100%2/2
A
A= $otherparsdefaults
Aresult
11
00
31 Names=>[map $_->name, @objects], Objects=>{map +($_->name => $_), @objects},
32 OtherParsDefaults=>$otherparsdefaults||{},
33 ArgOrder=>$argorder,
34 }, $type;
35 235 my @objects_sorted = ((grep !$_->{FlagW}, @objects), (grep $_->{FlagW}, @objects));
36 235 $objects_sorted[$_]{Number} = $_ for 0..$#objects_sorted;
37 235 $this->{NamesSorted} = [ map $_->name, @objects_sorted ];
38 235 $this->{DimsObj} = my $dimsobj = PDL::PP::PdlDimsObj->new;
39 235 $_->add_inds($dimsobj) for @objects;
40 235 ▶ @$this{qw(OtherNames OtherObjs OtherAnyOut OtherFlags)} = $this->_otherPars_nft($otherpars||'', $opname);
Condition100%2/2
$otherpars || ''
l!l
47188
MC/DC100%1/1
$otherpars || ''
$otherpars
Truth table100%2/2
A
A= $otherpars
Aresult
11
00
41 234 $this->_validate($opname);
42 230 my $i=0; $dimsobj->ind_obj($_)->set_index($i++) for sort $dimsobj->ind_names;
43 230 $this;
44 }
45  
46 234 ▶sub _validate {
Subroutine _validate: called CC=15 SCAR=27.1
47 234 my ($sig, $name) = @_;
48 234 my ($argorder, $otherdefaults) = @$sig{qw(ArgOrder OtherParsDefaults)};
49 234 ▶ if (!$argorder and
Branch: 1 branch
BranchTrueFalseTotal
if (not $argorder and keys %$otherdefaults != (my(@other_args) = @{$sig->{"OtherNames"};})) 34 200 234
Condition100%3/3
not $argorder and keys %$otherdefaults != (my(@other_args) = @{$sig->{"OtherNames"};})
!ll&&!rl&&r
1218834
MC/DC100%2/2
not $argorder and keys %$otherdefaults != (my(@other_args) = @{$sig->{"OtherNames"};})
not $argorder keys %$otherdefaults != (my(@other_args) = @{$sig->{"OtherNames"};})
Truth table100%3/3
not(A) and B
A= not $argorderB= keys %$otherdefaults != (my(@other_args) = @{$sig->{"OtherNames"};})
ABresult
0X0
100
111
50 222 keys(%$otherdefaults) != (my @other_args = @{ $sig->{OtherNames} })
51 ) {
52 34 my $default_seen = '';
53 34 for (@other_args) {
54 59 ▶ $default_seen = $_ if exists $otherdefaults->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if exists $otherdefaults->{$_} 4 55 59
55 confess "$name got default-less arg '$_' after default-ful arg '$default_seen'"
56 59 ▶ if $default_seen and !exists $otherdefaults->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if $default_seen and not exists $otherdefaults->{$_} 1 58 59
Condition100%3/3
$default_seen and not exists $otherdefaults->{$_}
!ll&&!rl&&r
5441
MC/DC100%2/2
$default_seen and not exists $otherdefaults->{$_}
$default_seen not exists $otherdefaults->{$_}
Truth table100%3/3
A and not(B)
A= $default_seenB= not exists $otherdefaults->{$_}
ABresult
0X0
100
111
57 }
58 }
59 233 ▶ if ($argorder and ref $argorder) {
Branch: 1 branch
BranchTrueFalseTotal
if ($argorder and ref $argorder) 6 227 233
Condition100%3/3
$argorder and ref $argorder
!ll&&!rl&&r
22166
MC/DC100%2/2
$argorder and ref $argorder
$argorder ref $argorder
Truth table100%3/3
A and B
A= $argorderB= ref $argorder
ABresult
0X0
100
111
60 6 my @names = @{ $sig->allnames(1, 1) };
61 6 my %namehash = map +($_=>1), @names;
62 6 delete @namehash{@$argorder};
63 6 ▶ confess "$name ArgOrder missed params: ".join(' ', keys %namehash) if keys %namehash;
Branch: 1 branch
BranchTrueFalseTotal
if keys %namehash 1 5 6
64 5 my %orderhash = map +($_=>1), @$argorder;
65 5 delete @orderhash{@names};
66 5 ▶ confess "$name ArgOrder too many params: ".join(' ', keys %orderhash) if keys %orderhash;
Branch: 1 branch
BranchTrueFalseTotal
if keys %orderhash 1 4 5
67 4 my %optionals = map +($_=>1), keys(%$otherdefaults), $sig->names_out, $sig->other_out;
68 4 my $optional = '';
69 4 for (@$argorder) {
70 17 ▶ $optional = $_, next if exists $optionals{$_};
Branch: 1 branch
BranchTrueFalseTotal
if exists $optionals{$_} 5 12 17
71 confess "$name got mandatory argument '$_' after optional argument '$optional'"
72 12 ▶ if $optional and !exists $optionals{$_};
Branch: 1 branch
BranchTrueFalseTotal
if $optional and not exists $optionals{$_} 1 11 12
Condition66%2/3
$optional and not exists $optionals{$_}
!ll&&!rl&&r
1101
MC/DC50%1/2
$optional and not exists $optionals{$_}
$optional not exists $optionals{$_}
Truth table66%2/3
A and not(B)
A= $optionalB= not exists $optionals{$_}
ABresult
0X0
100
111
73 }
74 }
75 }
76  
77 235 ▶sub _otherPars_nft {
Subroutine _otherPars_nft: called CC=14 SCAR=27.1
78 235 my ($sig,$otherpars,$opname) = @_;
79 235 ▶ my $dimobjs = $sig && $sig->dims_obj;
Condition33%1/3
$sig && $sig->dims_obj
!ll&&!rl&&r
00235
MC/DC0%0/2
$sig && $sig->dims_obj
$sig $sig->dims_obj
Truth table33%1/3
A && B
A= $sigB= $sig->dims_obj
ABresult
0X0
100
111
80 235 my (@names,%types,$type,$any_out,%allflags);
81 235 for (nospacesplit(';',$otherpars)) {
82 85 my (%flags);
83 85 ▶ if (s/^\s*$PDL::PP::PdlParObj::sqbr_re\s*//) {
Branch: 1 branch
BranchTrueFalseTotal
if (s/^\s*$PDL::PP::PdlParObj::sqbr_re\s*//) 18 67 85
84 18 %flags = my %lflags = map +($_=>1), split /\s*,\s*/, my $opts = $1;
85 18 ▶ croak "pp_def($opname): Can't have both [io] and [o]" if $lflags{o} && $lflags{io};
Branch: 1 branch
BranchTrueFalseTotal
if $lflags{"o"} and $lflags{"io"} 0 18 18
Condition66%2/3
$lflags{"o"} and $lflags{"io"}
!ll&&!rl&&r
2160
MC/DC0%0/2
$lflags{"o"} and $lflags{"io"}
$lflags{"o"} $lflags{"io"}
Truth table66%2/3
A and B
A= $lflags{"o"}B= $lflags{"io"}
ABresult
0X0
100
111
86 18 ▶ my $this_out = delete($lflags{o}) || delete($lflags{io});
Condition66%2/3
delete $lflags{'o'} || delete $lflags{'io'}
l!l&&r!l&&!r
1620
MC/DC0%0/2
delete $lflags{'o'} || delete $lflags{'io'}
delete $lflags{'o'} delete $lflags{'io'}
Truth table66%2/3
A || B
A= delete $lflags{'o'}B= delete $lflags{'io'}
ABresult
1X1
011
000
87 18 ▶ croak "pp_def($opname): Invalid options '$opts' in '$_'" if keys %lflags;
Branch: 1 branch
BranchTrueFalseTotal
if keys %lflags 0 18 18
88 18 ▶ $any_out ||= $this_out;
Condition66%2/3
$any_out ||= $this_out
l!l&&r!l&&!r
6120
MC/DC0%0/2
$any_out ||= $this_out
$any_out $this_out
Truth table66%2/3
A ||= B
A= $any_outB= $this_out
ABresult
1X1
011
000
89 }
90 85 ▶ if (/^\s*([^=]+?)\s*=>\s*(\S+)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*([^=]+?)\s*=>\s*(\S+)\s*$/) { } 2 83 85
91 # support 'int ndim => n;' syntax
92 2 my ($ctype,$dim) = ($1,$2);
93 2 ▶ print "OtherPars: setting dim '$dim' from '$ctype'\n" if $::PP_VERBOSE;
Branch: 1 branch
BranchTrueFalseTotal
if $main::PP_VERBOSE 0 2 2
94 2 $type = PDL::PP::CType->new($ctype);
95 2 $dimobjs->get_indobj_make($dim)->set_from($type);
96 } else {
97 83 $type = PDL::PP::CType->new($_);
98 }
99 85 my $name = $type->protoname;
100 85 ▶ confess "pp_def($opname): '$name' given in both Pars and OtherPars" if $sig->{Objects}{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $sig->{"Objects"}{$name} 0 85 85
101 croak "pp_def($opname): Invalid OtherPars name: $name"
102 85 ▶ if $PDL::PP::PdlParObj::INVALID_PAR{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $PDL::PP::PdlParObj::INVALID_PAR{$name} 1 84 85
103 84 push @names,$name;
104 84 $types{$name} = $type;
105 84 ▶ $types{"${name}_count"} = PDL::PP::CType->new("PDL_Indx ${name}_count") if $type->is_array;
Branch: 1 branch
BranchTrueFalseTotal
if $type->is_array 6 78 84
106 84 $allflags{$name} = \%flags;
107 }
108 234 (\@names,\%types,$any_out,\%allflags);
109 }
110  
111 =head1 AUTHOR
112  
113 Copyright (C) Tuomas J. Lukka 1997 (lukka@husc.harvard.edu) and by Christian
114 Soeller (c.soeller@auckland.ac.nz).
115 All rights reserved. There is no warranty. You are allowed
116 to redistribute this software / documentation under certain
117 conditions. For details, see the file COPYING in the PDL
118 distribution. If this file is separated from the PDL distribution,
119 the copyright notice should be included in the file.
120  
121 =cut
122  
123 6 ▶sub names { $_[0]{Names} }
Subroutine names: called CC=1 SCAR=0.0
Pod undocumented
124 73 ▶sub names_sorted { $_[0]{NamesSorted} }
Subroutine names_sorted: called CC=1 SCAR=0.0
Pod undocumented
125 62 ▶sub names_sorted_tuples {
Subroutine names_sorted_tuples: called CC=1 SCAR=0.0
Pod undocumented
126 62 my ($count, @names) = (0, @{$_[0]{NamesSorted}});
127 62 map [$count++, $_[0]{Objects}{$_}{FlagTemp}, $_], @names;
128 }
129  
130 935 ▶sub objs { $_[0]{Objects} }
Subroutine objs: called CC=1 SCAR=0.0
Pod undocumented
131 276 ▶sub names_in { my $o=$_[0]->objs; grep !$o->{$_}{FlagOut} && !$o->{$_}{FlagTemp}, @{$_[0]{Names}} }
Subroutine names_in: called CC=2 SCAR=7.0
Pod undocumented
Condition66%2/3
$o->{$_}{'FlagOut'} || $o->{$_}{'FlagTemp'}
l!l&&r!l&&!r
2300345
MC/DC50%1/2
$o->{$_}{'FlagOut'} || $o->{$_}{'FlagTemp'}
$o->{$_}{'FlagOut'} $o->{$_}{'FlagTemp'}
Truth table66%2/3
A || B
A= $o->{$_}{'FlagOut'}B= $o->{$_}{'FlagTemp'}
ABresult
1X1
011
000
132 157 ▶sub names_out { my $o=$_[0]->objs; grep $o->{$_}{FlagOut}, @{$_[0]{Names}} }
Subroutine names_out: called CC=1 SCAR=0.0
Pod undocumented
133 204 ▶sub names_oca { my $o=$_[0]->objs; grep $o->{$_}{FlagCreateAlways}, @{$_[0]{Names}} }
Subroutine names_oca: called CC=1 SCAR=0.0
Pod undocumented
134 125 ▶sub names_out_nca { my $o=$_[0]->objs; grep $o->{$_}{FlagOut} && !$o->{$_}{FlagCreateAlways}, @{$_[0]{Names}} }
Subroutine names_out_nca: called CC=2 SCAR=6.9
Pod undocumented
Condition100%3/3
$o->{$_}{'FlagOut'} && !$o->{$_}{'FlagCreateAlways'}
!ll&&!rl&&r
1552101
MC/DC100%2/2
$o->{$_}{'FlagOut'} && !$o->{$_}{'FlagCreateAlways'}
$o->{$_}{'FlagOut'} !$o->{$_}{'FlagCreateAlways'}
Truth table100%3/3
A && not(B)
A= $o->{$_}{'FlagOut'}B= !$o->{$_}{'FlagCreateAlways'}
ABresult
0X0
100
111
135 0 ▶sub names_tmp { my $o=$_[0]->objs; grep $o->{$_}{FlagTemp}, @{$_[0]{Names}} }
Subroutine names_tmp: not called CC=1 SCAR=6.9
Pod undocumented
136  
137 317 ▶sub dims_obj { $_[0]->{DimsObj} }
Subroutine dims_obj: called CC=1 SCAR=0.0
Pod undocumented
138 59 ▶sub dims_init {
Subroutine dims_init: called CC=1 SCAR=0.0
Pod undocumented
139 59 my ($self) = @_;
140 join "\n",
141 (sort map $_->get_initdim, $self->{DimsObj}->ind_fromcomp),
142 59 (sort map $_->get_initdim, $self->{DimsObj}->ind_notfromcomp);
143 }
144  
145 1824 ▶sub othernames {
Subroutine othernames: called CC=11 SCAR=24.2
Pod undocumented
146 1824 my ($self, $omit_count, $with_xs, $except) = @_;
147 1824 ▶ $except ||= {};
Condition100%2/2
$except ||= {}
l!l
621762
MC/DC100%1/1
$except ||= {}
$except
Truth table100%2/2
A
A= $except
Aresult
11
00
148 1824 ▶ return $self->{OtherNames} if $omit_count && $omit_count > 0 && !keys %$except && $with_xs;
Branch: 1 branch
BranchTrueFalseTotal
if $omit_count and $omit_count > 0 and not keys %$except and $with_xs 521 1303 1824
Condition77%7/9
$omit_count and $omit_count > 0 and not keys %$except and $with_xs
!ll&&!rl&&r
13030521
$omit_count and $omit_count > 0 and not keys %$except
!ll&&!rl&&r
124459521
$omit_count and $omit_count > 0
!ll&&!rl&&r
12440580
MC/DC50%2/4
$omit_count and $omit_count > 0 and not keys %$except and $with_xs
$omit_count $omit_count > 0 not keys %$except $with_xs
Truth table60%3/5
A and B and not(C) and D
A= $omit_countB= $omit_count > 0C= not keys %$exceptD= $with_xs
ABCDresult
0XXX0
10XX0
110X0
11100
11111
149 1303 ▶ return [] if $omit_count && $omit_count < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $omit_count and $omit_count < 0 0 1303 1303
Condition66%2/3
$omit_count and $omit_count < 0
!ll&&!rl&&r
1244590
MC/DC0%0/2
$omit_count and $omit_count < 0
$omit_count $omit_count < 0
Truth table66%2/3
A and B
A= $omit_countB= $omit_count < 0
ABresult
0X0
100
111
150 1303 my $objs = $self->otherobjs;
151 1303 my @raw_names = grep !$except->{$_}, @{$self->{OtherNames}};
152 1303 ▶ @raw_names = map $objs->{$_}->is_array ? ($_, "${_}_count") : $_, @raw_names if !$omit_count;
Branch: 2 branches
BranchTrueFalseTotal
unless $omit_count 1244 59 1303
$objs->{$_}->is_array ? : 39 350 389
153 1303 ▶ @raw_names = grep !$objs->{$_}{WasDollar}, @raw_names if !$with_xs;
Branch: 1 branch
BranchTrueFalseTotal
unless $with_xs 1244 59 1303
154 1303 \@raw_names;
155 }
156 2795 ▶sub otherobjs { $_[0]{OtherObjs} }
Subroutine otherobjs: called CC=1 SCAR=0.0
Pod undocumented
157 34 ▶sub other_any_out { $_[0]{OtherAnyOut} }
Subroutine other_any_out: called CC=1 SCAR=0.0
Pod undocumented
158 1009 ▶sub other_is_flag {
Subroutine other_is_flag: called CC=4 SCAR=13.9
Pod undocumented
159 1009 my $flag = $_[2];
160 1009 my $has_count = (my $without_count = $_[1]) =~ s/_count$//;
161 1009 ▶ return $_[0]{OtherFlags}{$_[1]} && $_[0]{OtherFlags}{$_[1]}{$flag} if !$has_count;
Branch: 1 branch
BranchTrueFalseTotal
unless $has_count 984 25 1009
Condition100%3/3
$_[0]{'OtherFlags'}{$_[1]} && $_[0]{'OtherFlags'}{$_[1]}{$flag}
!ll&&!rl&&r
51239775
MC/DC100%2/2
$_[0]{'OtherFlags'}{$_[1]} && $_[0]{'OtherFlags'}{$_[1]}{$flag}
$_[0]{'OtherFlags'}{$_[1]} $_[0]{'OtherFlags'}{$_[1]}{$flag}
Truth table100%3/3
A && B
A= $_[0]{'OtherFlags'}{$_[1]}B= $_[0]{'OtherFlags'}{$_[1]}{$flag}
ABresult
0X0
100
111
162 25 ▶ $_[0]{OtherFlags}{$without_count} && $_[0]{OtherFlags}{$without_count}{$flag};
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"OtherFlags"}{$without_count} and $_[0]{"OtherFlags"}{$without_count}{$flag} 25 0 25
163 }
164 382 ▶sub other_is_output { &other_is_out || &other_is_io }
Subroutine other_is_output: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
&other_is_out or &other_is_io 33 349 382
165 567 ▶sub other_is_out { $_[0]->other_is_flag($_[1], 'o') }
Subroutine other_is_out: called CC=1 SCAR=0.0
Pod undocumented
166 321 ▶sub other_out { grep $_[0]->other_is_out($_), @{$_[0]{OtherNames}} }
Subroutine other_out: called CC=1 SCAR=0.0
Pod undocumented
167 442 ▶sub other_is_io { $_[0]->other_is_flag($_[1], 'io') }
Subroutine other_is_io: called CC=1 SCAR=0.0
Pod undocumented
168 186 ▶sub other_io { grep $_[0]->other_is_io($_), @{$_[0]{OtherNames}} }
Subroutine other_io: called CC=1 SCAR=0.0
Pod undocumented
169  
170 450 ▶sub allnames { my ($self, $omit_count, $with_xs, $except) = @_; [
Subroutine allnames: called CC=5 SCAR=19.6
Pod undocumented
171 0 ▶ ($omit_count && $omit_count < 0) ? (grep $self->{Objects}{$_}{FlagCreateAlways}, @{$self->{Names}}) :
Condition33%2/6
$except && $except->{$_} || $self->{'Objects'}{$_}{'FlagTemp'}
l!l&&r!l&&!r
00930
$except and $except->{$_}
!ll&&!rl&&r
93000
MC/DC0%0/3
$except && $except->{$_} || $self->{'Objects'}{$_}{'FlagTemp'}
$except $except->{$_} $self->{'Objects'}{$_}{'FlagTemp'}
Truth table20%1/5
A and B || C
A= $exceptB= $except->{$_}C= $self->{'Objects'}{$_}{'FlagTemp'}
ABCresult
11X1
0X11
1011
0X00
1000
172 450 (grep +(!$except || !$except->{$_}) && !$self->{Objects}{$_}{FlagTemp}, @{$self->{Names}}),
173 450 ▶ @{$self->othernames(@_[1..3])},
Branch: 1 branch
BranchTrueFalseTotal
$omit_count && $omit_count < 0 ? : 0 450 450
Condition66%2/3
$omit_count and $omit_count < 0
!ll&&!rl&&r
1243260
MC/DC0%0/2
$omit_count and $omit_count < 0
$omit_count $omit_count < 0
Truth table66%2/3
A and B
A= $omit_countB= $omit_count < 0
ABresult
0X0
100
111
174 ] }
175 124 ▶sub allobjs {
Subroutine allobjs: called CC=1 SCAR=0.0
Pod undocumented
176 124 my $pdltype = PDL::PP::CType->new("pdl *__foo__");
177 124 +{ ( map +($_,$pdltype), @{$_[0]{Names}} ), %{$_[0]->otherobjs} };
178 }
179 124 ▶sub alldecls {
Subroutine alldecls: called CC=2 SCAR=6.9
Pod undocumented
180 124 my ($self, $omit_count, $indirect, $with_xs, $except) = @_;
181 124 my $objs = $self->allobjs;
182 124 my @names = @{$self->allnames($omit_count, $with_xs, $except)};
183 124 ▶ $indirect = $indirect ? { map +($_=>$self->other_is_output($_)), @names } : {};
Branch: 1 branch
BranchTrueFalseTotal
$indirect ? : 62 62 124
184 124 map $objs->{$_}->get_decl($_, {VarArrays2Ptrs=>1,AddIndirect=>$indirect->{$_}}), @names;
185 }
186 72 ▶sub getcomp {
Subroutine getcomp: called CC=1 SCAR=0.0
Pod undocumented
187 72 my ($self) = @_;
188 72 my $objs = $self->otherobjs;
189 72 my @names = @{$self->othernames(0)};
190 72 my $indirect = { map +($_=>$self->other_is_output($_)), @names };
191 72 join "\n", map " $_;", grep $_, map $objs->{$_}->get_decl($_, {VarArrays2Ptrs=>1,AddIndirect=>$indirect->{$_}}), @names;
192 }
193 118 ▶sub getfree {
Subroutine getfree: called CC=1 SCAR=0.0
Pod undocumented
194 118 my ($self,$symbol) = @_;
195 118 my $objs = $self->otherobjs;
196 join '', map $objs->{$_}->get_free("\$$symbol($_)",
197 118 { VarArrays2Ptrs => 1 }), @{$self->othernames(0)};
198 }
199 62 ▶sub getcopy {
Subroutine getcopy: called CC=1 SCAR=0.0
Pod undocumented
200 62 my ($self, $to_pat) = @_;
201 62 my $objs = $self->otherobjs;
202 62 PDL::PP::indent(2, join '', map $objs->{$_}->get_copy($_,sprintf $to_pat,$_)."\n", @{$self->othernames(0)});
203 }
204  
205 144 ▶sub args_callorder {
Subroutine args_callorder: called CC=4 SCAR=13.9
Pod undocumented
206 144 my ($self) = @_;
207 144 my $argorder = $self->{ArgOrder};
208 144 ▶ return $self->allnames(1, 1) if !$argorder;
Branch: 1 branch
BranchTrueFalseTotal
unless $argorder 134 10 144
209 10 ▶ return $argorder if ref $argorder;
Branch: 1 branch
BranchTrueFalseTotal
if ref $argorder 4 6 10
210 6 my $otherdefaults = $self->{OtherParsDefaults};
211 6 my %optionals = map +($_=>1), keys(%$otherdefaults);
212 my @other_mand = grep !$optionals{$_} && !$self->other_is_out($_),
213 6 ▶ my @other = @{$self->othernames(1, 1)};
Condition100%3/3
$optionals{$_} || $self->other_is_out($_)
l!l&&r!l&&!r
826
MC/DC100%2/2
$optionals{$_} || $self->other_is_out($_)
$optionals{$_} $self->other_is_out($_)
Truth table100%3/3
A || B
A= $optionals{$_}B= $self->other_is_out($_)
ABresult
1X1
011
000
214 6 my @other_opt = grep $optionals{$_}, @other;
215 6 [$self->names_in, @other_mand, @other_opt, $self->names_out, $self->other_out];
216 }
217  
218 10 ▶sub realdims {
Subroutine realdims: called CC=1 SCAR=0.0
Pod undocumented
219 10 my $this = shift;
220 10 [ map scalar @{$this->{Objects}{$_}{RawInds}}, @{$this->{Names}} ];
221 }
222  
223 10 ▶sub creating {
Subroutine creating: called CC=2 SCAR=7.1
Pod undocumented
224 10 my $this = shift;
225 confess "you must perform a checkdims before calling creating"
226 10 ▶ unless defined $this->{Create};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $this->{"Create"} 0 10 10
227 10 return $this->{Create};
228 }
229  
230 12 ▶sub checkdims {
Subroutine checkdims: called CC=9 SCAR=22.1
Pod undocumented
231 12 my $this = shift;
232 # we have to recreate to keep defaults currently
233 12 $this->{Dims} = PDL::PP::PdlDimsObj->new;
234 12 $this->{Objects}{$_}->add_inds($this->{Dims}) for @{$this->{Names}};
235 12 my $n = @{$this->{Names}};
236 12 ▶ confess "not enough pdls to match signature" unless $#_ >= $n-1;
Branch: 1 branch
BranchTrueFalseTotal
unless $#_ >= $n - 1 0 12 12
237 12 my @pdls = @_[0..$n-1];
238 12 ▶ if ($PDL::debug) { print "args: ".
Branch: 1 branch
BranchTrueFalseTotal
if ($PDL::debug) 0 12 12
239 0 join(' ,',map { "[".join(',',$_->dims)."]," } @pdls)
240 . "\n"}
241 12 my $i = 0;
242 my @creating = map $this->{Objects}{$_}->perldimcheck($pdls[$i++]),
243 12 @{$this->{Names}};
244 10 $i = 0;
245 10 for (@{$this->{Names}}) {
246 27 ▶ push @creating, $this->{Objects}{$_}->getcreatedims
Branch: 1 branch
BranchTrueFalseTotal
if $creating[$i++] 8 19 27
247 if $creating[$i++];
248 }
249 10 $this->{Create} = \@creating;
250 10 $i = 0;
251 10 my $corr = 0;
252 10 for (@{$this->{Names}}) {
253 27 $corr = $this->{Objects}{$_}->finalcheck($pdls[$i++]);
254 27 ▶ next unless $#$corr>-1;
Branch: 1 branch
BranchTrueFalseTotal
unless $corr->$#* > -1 26 1 27
255 1 my ($j,$str) = (0,"");
256 1 for (@$corr) {$str.= ":,"x($_->[0]-$j)."(0),*$_->[1],";
257 1 $j=$_->[0]+1 }
258 1 chop $str;
259 1 $_[$i-1] = $pdls[$i-1]->slice($str);
260 }
261 }
262  
263 6 1;
« blib/lib/PDL/Parallel/threads/SIMD.pm ↑ Summary blib/lib/PDL/IO/Dumper.pm »