blib/lib/PDL/PP/Signature.pm

filter: Statementstmt 96.5% 195 / 202 Branchbran 76.4% 52 / 68 Conditioncond 71.2% 47 / 66 MC/DCmcdc 47.5% 19 / 40 Subroutinesub 97.4% 38 / 39 Podpod 0.0% 0 / 32 totaltotal 78.5% 351 / 447 CC 68 SCAR 20.8
CC
68
Cov
88%
_otherPars_nft
16.9
_validate
15.0
othernames
11.4
CRAP 8.0
« blib/lib/PDL/Parallel/threads/SIMD.pm ↑ Summary blib/lib/PDL/PP/PdlParObj.pm »
1 package # hide from PAUSE/MetaCPAN
2 PDL::PP::Signature;
3  
4 4 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use PDL::PP::PdlParObj;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use PDL::PP::Dims;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶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 321 ▶sub nospacesplit {grep /\S/, split $_[0],$_[1]}
Subroutine nospacesplit: called CC=1 SCAR=0.0
Pod undocumented
25  
26 sub new {
27 161 ▶ my ($type,$pars,$opname,$otherpars,$otherparsdefaults,$argorder) = @_;
Subroutine new: called CC=8 SCAR=20.8
Pod undocumented
28 161 ▶ confess "$opname ArgOrder given defined but false value" if defined $argorder and !$argorder;
Branch: 1 branch
BranchTrueFalseTotal
if defined $argorder and not $argorder 0 161 161
Condition66%2/3
defined $argorder and not $argorder
!ll&&!rl&&r
150110
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 161 my @objects = map PDL::PP::PdlParObj->new($_, $opname), nospacesplit ';',$pars;
30 160 ▶ my $this = bless {
Condition100%2/2
$otherparsdefaults || {}
l!l
10150
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 160 my @objects_sorted = ((grep !$_->{FlagW}, @objects), (grep $_->{FlagW}, @objects));
36 160 $objects_sorted[$_]{Number} = $_ for 0..$#objects_sorted;
37 160 $this->{NamesSorted} = [ map $_->name, @objects_sorted ];
38 160 $this->{DimsObj} = my $dimsobj = PDL::PP::PdlDimsObj->new;
39 160 $_->add_inds($dimsobj) for @objects;
40 160 ▶ @$this{qw(OtherNames OtherObjs OtherAnyOut OtherFlags)} = $this->_otherPars_nft($otherpars||'', $opname);
Condition100%2/2
$otherpars || ''
l!l
25135
MC/DC100%1/1
$otherpars || ''
$otherpars
Truth table100%2/2
A
A= $otherpars
Aresult
11
00
41 159 $this->_validate($opname);
42 155 my $i=0; $dimsobj->ind_obj($_)->set_index($i++) for sort $dimsobj->ind_names;
43 155 $this;
44 }
45  
46 sub _validate {
47 159 ▶ my ($sig, $name) = @_;
Subroutine _validate: called CC=15 SCAR=27.1
48 159 my ($argorder, $otherdefaults) = @$sig{qw(ArgOrder OtherParsDefaults)};
49 159 ▶ if (!$argorder and
Branch: 1 branch
BranchTrueFalseTotal
if (not $argorder and keys %$otherdefaults != (my(@other_args) = @{$sig->{"OtherNames"};})) 13 146 159
Condition100%3/3
not $argorder and keys %$otherdefaults != (my(@other_args) = @{$sig->{"OtherNames"};})
!ll&&!rl&&r
1113513
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 148 keys(%$otherdefaults) != (my @other_args = @{ $sig->{OtherNames} })
51 ) {
52 13 my $default_seen = '';
53 13 for (@other_args) {
54 18 ▶ $default_seen = $_ if exists $otherdefaults->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if exists $otherdefaults->{$_} 2 16 18
55 confess "$name got default-less arg '$_' after default-ful arg '$default_seen'"
56 18 ▶ if $default_seen and !exists $otherdefaults->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if $default_seen and not exists $otherdefaults->{$_} 1 17 18
Condition100%3/3
$default_seen and not exists $otherdefaults->{$_}
!ll&&!rl&&r
1521
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 158 ▶ if ($argorder and ref $argorder) {
Branch: 1 branch
BranchTrueFalseTotal
if ($argorder and ref $argorder) 6 152 158
Condition100%3/3
$argorder and ref $argorder
!ll&&!rl&&r
14756
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 sub _otherPars_nft {
78 160 ▶ my ($sig,$otherpars,$opname) = @_;
Subroutine _otherPars_nft: called CC=14 SCAR=28.3
79 160 ▶ my $dimobjs = $sig && $sig->dims_obj;
Condition33%1/3
$sig && $sig->dims_obj
!ll&&!rl&&r
00160
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 160 my (@names,%types,$type,$any_out,%allflags);
81 160 for (nospacesplit(';',$otherpars)) {
82 41 my (%flags);
83 41 ▶ if (s/^\s*$PDL::PP::PdlParObj::sqbr_re\s*//) {
Branch: 1 branch
BranchTrueFalseTotal
if (s/^\s*$PDL::PP::PdlParObj::sqbr_re\s*//) 2 39 41
84 2 %flags = my %lflags = map +($_=>1), split /\s*,\s*/, my $opts = $1;
85 2 ▶ 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 2 2
Condition33%1/3
$lflags{"o"} and $lflags{"io"}
!ll&&!rl&&r
020
MC/DC0%0/2
$lflags{"o"} and $lflags{"io"}
$lflags{"o"} $lflags{"io"}
Truth table33%1/3
A and B
A= $lflags{"o"}B= $lflags{"io"}
ABresult
0X0
100
111
86 2 ▶ my $this_out = delete($lflags{o}) || delete($lflags{io});
Condition33%1/3
delete $lflags{'o'} || delete $lflags{'io'}
l!l&&r!l&&!r
200
MC/DC0%0/2
delete $lflags{'o'} || delete $lflags{'io'}
delete $lflags{'o'} delete $lflags{'io'}
Truth table33%1/3
A || B
A= delete $lflags{'o'}B= delete $lflags{'io'}
ABresult
1X1
011
000
87 2 ▶ croak "pp_def($opname): Invalid options '$opts' in '$_'" if keys %lflags;
Branch: 1 branch
BranchTrueFalseTotal
if keys %lflags 0 2 2
88 2 ▶ $any_out ||= $this_out;
Condition33%1/3
$any_out ||= $this_out
l!l&&r!l&&!r
020
MC/DC0%0/2
$any_out ||= $this_out
$any_out $this_out
Truth table33%1/3
A ||= B
A= $any_outB= $this_out
ABresult
1X1
011
000
89 }
90 41 ▶ if (/^\s*([^=]+?)\s*=>\s*(\S+)\s*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^\s*([^=]+?)\s*=>\s*(\S+)\s*$/) { } 2 39 41
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 39 $type = PDL::PP::CType->new($_);
98 }
99 41 my $name = $type->protoname;
100 41 ▶ confess "pp_def($opname): '$name' given in both Pars and OtherPars" if $sig->{Objects}{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $sig->{"Objects"}{$name} 0 41 41
101 croak "pp_def($opname): Invalid OtherPars name: $name"
102 41 ▶ if $PDL::PP::PdlParObj::INVALID_PAR{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $PDL::PP::PdlParObj::INVALID_PAR{$name} 1 40 41
103 40 push @names,$name;
104 40 $types{$name} = $type;
105 40 ▶ $types{"${name}_count"} = PDL::PP::CType->new("PDL_Indx ${name}_count") if $type->is_array;
Branch: 1 branch
BranchTrueFalseTotal
if $type->is_array 0 40 40
106 40 $allflags{$name} = \%flags;
107 }
108 159 (\@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 22 ▶sub names_sorted { $_[0]{NamesSorted} }
Subroutine names_sorted: called CC=1 SCAR=0.0
Pod undocumented
125 sub names_sorted_tuples {
126 37 ▶ my ($count, @names) = (0, @{$_[0]{NamesSorted}});
Subroutine names_sorted_tuples: called CC=1 SCAR=0.0
Pod undocumented
127 37 map [$count++, $_[0]{Objects}{$_}{FlagTemp}, $_], @names;
128 }
129  
130 565 ▶sub objs { $_[0]{Objects} }
Subroutine objs: called CC=1 SCAR=0.0
Pod undocumented
131 174 ▶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
1360217
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 104 ▶sub names_out { my $o=$_[0]->objs; grep $o->{$_}{FlagOut}, @{$_[0]{Names}} }
Subroutine names_out: called CC=1 SCAR=0.0
Pod undocumented
133 128 ▶sub names_oca { my $o=$_[0]->objs; grep $o->{$_}{FlagCreateAlways}, @{$_[0]{Names}} }
Subroutine names_oca: called CC=1 SCAR=0.0
Pod undocumented
134 75 ▶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
93255
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 183 ▶sub dims_obj { $_[0]->{DimsObj} }
Subroutine dims_obj: called CC=1 SCAR=0.0
Pod undocumented
138 sub dims_init {
139 34 ▶ my ($self) = @_;
Subroutine dims_init: called CC=1 SCAR=0.0
Pod undocumented
140 join "\n",
141 (sort map $_->get_initdim, $self->{DimsObj}->ind_fromcomp),
142 34 (sort map $_->get_initdim, $self->{DimsObj}->ind_notfromcomp);
143 }
144  
145 sub othernames {
146 1048 ▶ my ($self, $omit_count, $with_xs, $except) = @_;
Subroutine othernames: called CC=11 SCAR=24.3
Pod undocumented
147 1048 ▶ $except ||= {};
Condition100%2/2
$except ||= {}
l!l
371011
MC/DC100%1/1
$except ||= {}
$except
Truth table100%2/2
A
A= $except
Aresult
11
00
148 1048 ▶ 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 317 731 1048
Condition77%7/9
$omit_count and $omit_count > 0 and not keys %$except and $with_xs
!ll&&!rl&&r
7310317
$omit_count and $omit_count > 0 and not keys %$except
!ll&&!rl&&r
69437317
$omit_count and $omit_count > 0
!ll&&!rl&&r
6940354
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 731 ▶ return [] if $omit_count && $omit_count < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $omit_count and $omit_count < 0 0 731 731
Condition66%2/3
$omit_count and $omit_count < 0
!ll&&!rl&&r
694370
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 731 my $objs = $self->otherobjs;
151 731 my @raw_names = grep !$except->{$_}, @{$self->{OtherNames}};
152 731 ▶ @raw_names = map $objs->{$_}->is_array ? ($_, "${_}_count") : $_, @raw_names if !$omit_count;
Branch: 2 branches
BranchTrueFalseTotal
unless $omit_count 694 37 731
$objs->{$_}->is_array ? : 0 103 103
153 731 ▶ @raw_names = grep !$objs->{$_}{WasDollar}, @raw_names if !$with_xs;
Branch: 1 branch
BranchTrueFalseTotal
unless $with_xs 694 37 731
154 731 \@raw_names;
155 }
156 1573 ▶sub otherobjs { $_[0]{OtherObjs} }
Subroutine otherobjs: called CC=1 SCAR=0.0
Pod undocumented
157 9 ▶sub other_any_out { $_[0]{OtherAnyOut} }
Subroutine other_any_out: called CC=1 SCAR=0.0
Pod undocumented
158 sub other_is_flag {
159 448 ▶ my $flag = $_[2];
Subroutine other_is_flag: called CC=4 SCAR=15.6
Pod undocumented
160 448 my $has_count = (my $without_count = $_[1]) =~ s/_count$//;
161 448 ▶ return $_[0]{OtherFlags}{$_[1]} && $_[0]{OtherFlags}{$_[1]}{$flag} if !$has_count;
Branch: 1 branch
BranchTrueFalseTotal
unless $has_count 448 0 448
Condition100%3/3
$_[0]{'OtherFlags'}{$_[1]} && $_[0]{'OtherFlags'}{$_[1]}{$flag}
!ll&&!rl&&r
2961484
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 0 ▶ $_[0]{OtherFlags}{$without_count} && $_[0]{OtherFlags}{$without_count}{$flag};
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"OtherFlags"}{$without_count} and $_[0]{"OtherFlags"}{$without_count}{$flag} 0 0 0
163 }
164 176 ▶sub other_is_output { &other_is_out || &other_is_io }
Subroutine other_is_output: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
&other_is_out or &other_is_io 176 0 176
165 245 ▶sub other_is_out { $_[0]->other_is_flag($_[1], 'o') }
Subroutine other_is_out: called CC=1 SCAR=0.0
Pod undocumented
166 194 ▶sub other_out { grep $_[0]->other_is_out($_), @{$_[0]{OtherNames}} }
Subroutine other_out: called CC=1 SCAR=0.0
Pod undocumented
167 203 ▶sub other_is_io { $_[0]->other_is_flag($_[1], 'io') }
Subroutine other_is_io: called CC=1 SCAR=0.0
Pod undocumented
168 111 ▶sub other_io { grep $_[0]->other_is_io($_), @{$_[0]{OtherNames}} }
Subroutine other_io: called CC=1 SCAR=0.0
Pod undocumented
169  
170 276 ▶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
00555
$except and $except->{$_}
!ll&&!rl&&r
55500
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 276 (grep +(!$except || !$except->{$_}) && !$self->{Objects}{$_}{FlagTemp}, @{$self->{Names}}),
173 276 ▶ @{$self->othernames(@_[1..3])},
Branch: 1 branch
BranchTrueFalseTotal
$omit_count && $omit_count < 0 ? : 0 276 276
Condition66%2/3
$omit_count and $omit_count < 0
!ll&&!rl&&r
742020
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 sub allobjs {
176 74 ▶ my $pdltype = PDL::PP::CType->new("pdl *__foo__");
Subroutine allobjs: called CC=1 SCAR=0.0
Pod undocumented
177 74 +{ ( map +($_,$pdltype), @{$_[0]{Names}} ), %{$_[0]->otherobjs} };
178 }
179 sub alldecls {
180 74 ▶ my ($self, $omit_count, $indirect, $with_xs, $except) = @_;
Subroutine alldecls: called CC=2 SCAR=6.9
Pod undocumented
181 74 my $objs = $self->allobjs;
182 74 my @names = @{$self->allnames($omit_count, $with_xs, $except)};
183 74 ▶ $indirect = $indirect ? { map +($_=>$self->other_is_output($_)), @names } : {};
Branch: 1 branch
BranchTrueFalseTotal
$indirect ? : 37 37 74
184 74 map $objs->{$_}->get_decl($_, {VarArrays2Ptrs=>1,AddIndirect=>$indirect->{$_}}), @names;
185 }
186 sub getcomp {
187 47 ▶ my ($self) = @_;
Subroutine getcomp: called CC=1 SCAR=0.0
Pod undocumented
188 47 my $objs = $self->otherobjs;
189 47 my @names = @{$self->othernames(0)};
190 47 my $indirect = { map +($_=>$self->other_is_output($_)), @names };
191 47 join "\n", map " $_;", grep $_, map $objs->{$_}->get_decl($_, {VarArrays2Ptrs=>1,AddIndirect=>$indirect->{$_}}), @names;
192 }
193 sub getfree {
194 68 ▶ my ($self,$symbol) = @_;
Subroutine getfree: called CC=1 SCAR=0.0
Pod undocumented
195 68 my $objs = $self->otherobjs;
196 join '', map $objs->{$_}->get_free("\$$symbol($_)",
197 68 { VarArrays2Ptrs => 1 }), @{$self->othernames(0)};
198 }
199 sub getcopy {
200 37 ▶ my ($self, $to_pat) = @_;
Subroutine getcopy: called CC=1 SCAR=0.0
Pod undocumented
201 37 my $objs = $self->otherobjs;
202 37 PDL::PP::indent(2, join '', map $objs->{$_}->get_copy($_,sprintf $to_pat,$_)."\n", @{$self->othernames(0)});
203 }
204  
205 sub args_callorder {
206 93 ▶ my ($self) = @_;
Subroutine args_callorder: called CC=4 SCAR=13.9
Pod undocumented
207 93 my $argorder = $self->{ArgOrder};
208 93 ▶ return $self->allnames(1, 1) if !$argorder;
Branch: 1 branch
BranchTrueFalseTotal
unless $argorder 85 8 93
209 8 ▶ return $argorder if ref $argorder;
Branch: 1 branch
BranchTrueFalseTotal
if ref $argorder 4 4 8
210 4 my $otherdefaults = $self->{OtherParsDefaults};
211 4 my %optionals = map +($_=>1), keys(%$otherdefaults);
212 my @other_mand = grep !$optionals{$_} && !$self->other_is_out($_),
213 4 ▶ my @other = @{$self->othernames(1, 1)};
Condition100%3/3
$optionals{$_} || $self->other_is_out($_)
l!l&&r!l&&!r
226
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 4 my @other_opt = grep $optionals{$_}, @other;
215 4 [$self->names_in, @other_mand, @other_opt, $self->names_out, $self->other_out];
216 }
217  
218 sub realdims {
219 10 ▶ my $this = shift;
Subroutine realdims: called CC=1 SCAR=0.0
Pod undocumented
220 10 [ map scalar @{$this->{Objects}{$_}{RawInds}}, @{$this->{Names}} ];
221 }
222  
223 sub creating {
224 10 ▶ my $this = shift;
Subroutine creating: called CC=2 SCAR=7.1
Pod undocumented
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 sub checkdims {
231 12 ▶ my $this = shift;
Subroutine checkdims: called CC=9 SCAR=22.1
Pod undocumented
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 4 1;
« blib/lib/PDL/Parallel/threads/SIMD.pm ↑ Summary blib/lib/PDL/PP/PdlParObj.pm »