line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# GENERATED WITH PDL::PP! Don't modify! |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
package PDL::CCS::Ops; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
@EXPORT_OK = qw( PDL::PP ccs_binop_align_block_mia ); |
8
|
|
|
|
|
|
|
%EXPORT_TAGS = (Func=>[@EXPORT_OK]); |
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
27
|
use PDL::Core; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
35
|
|
11
|
4
|
|
|
4
|
|
981
|
use PDL::Exporter; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
23
|
|
12
|
4
|
|
|
4
|
|
116
|
use DynaLoader; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
292
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$PDL::CCS::Ops::VERSION = 1.23.12; |
17
|
|
|
|
|
|
|
@ISA = ( 'PDL::Exporter','DynaLoader' ); |
18
|
|
|
|
|
|
|
push @PDL::Core::PP, __PACKAGE__; |
19
|
|
|
|
|
|
|
bootstrap PDL::CCS::Ops $VERSION; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#use PDL::CCS::Version; |
26
|
4
|
|
|
4
|
|
24
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
337
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
PDL::CCS::Ops - Low-level binary operations for compressed storage sparse PDLs |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use PDL; |
37
|
|
|
|
|
|
|
use PDL::CCS::Utils; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
##--------------------------------------------------------------------- |
40
|
|
|
|
|
|
|
## ... stuff happens |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 FUNCTIONS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
*ccs_indx = \&PDL::indx; ##-- typecasting for CCS indices |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 ccs_binop_align_block_mia |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=for sig |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Signature: ( |
69
|
|
|
|
|
|
|
indx ixa(Ndims,NnzA); indx ixb(Ndims,NnzB); indx istate(State); |
70
|
|
|
|
|
|
|
indx [o]nzai(NnzC); indx [o]nzbi(NnzC); indx [o]ostate(State); |
71
|
|
|
|
|
|
|
) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Partially aligns a pair of lexicographically sorted index-vector lists C<$ixa()> and C<$ixb()>, |
75
|
|
|
|
|
|
|
e.g. for block-wise incremental computation of binary operations over sparse index-encoded PDLs, |
76
|
|
|
|
|
|
|
assuming missing indices correspond to annihilators. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
On return, the vectors C<$nzai> and C<$nzbi> hold indices into C and C |
79
|
|
|
|
|
|
|
respectively, and are constructed such that: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
($ixa(,$nzai->slice("0:$nzci_max")) == $ixb(,$nzbi->slice("0:$nzci_max")) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
At most C alignments are performed, and alignment ceases |
84
|
|
|
|
|
|
|
as soon as any of the PDLs C<$ixa()>, C<$ixb()>, C<$nzai()>, or C<$nzbi()> |
85
|
|
|
|
|
|
|
has been exhausted. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
The parameters C<$istate()> and C<$ostate()> hold the state of the algorithm, |
88
|
|
|
|
|
|
|
for incremental block-wise computation at the perl level. Each state PDL |
89
|
|
|
|
|
|
|
is a 7-element PDL containing the following values: |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
INDEX LABEL DESCRIPTION |
92
|
|
|
|
|
|
|
----------------------------------------------------------------------- |
93
|
|
|
|
|
|
|
0 nnzai minimum offset in NnzA of current $ixa() value |
94
|
|
|
|
|
|
|
1 nnzai_nxt minimum offset in NnzA of next $ixa() value |
95
|
|
|
|
|
|
|
2 nnzbi minimum offset in NnzB of current $ixb() value |
96
|
|
|
|
|
|
|
3 nnzbi_nxt minimum offset in NnzB of next $ixb() value |
97
|
|
|
|
|
|
|
4 nnzci minimum offset in NnzC of current ($ixa(),$ixb()) value pair |
98
|
|
|
|
|
|
|
5 nnzci_nxt minimum offset in NnzC of next ($ixa(),$ixb()) value pair |
99
|
|
|
|
|
|
|
6 cmpval 3-way comparison value for current ($ixa(),$ixb()) value pair |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
For computation of the first block, $istate() can be safely set to C. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Repetitions may occur in input index PDLs C<$ixa()> and C<$ixb()>. |
104
|
|
|
|
|
|
|
If an index-match occurs on such a "run", I of matching values are |
105
|
|
|
|
|
|
|
added to the output PDLs. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
All alignments have been performed if: |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$ostate(0)==$NnzA && $ostate(1)==$NnzB |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
B this alignment method ignores index-vectors which are not present |
112
|
|
|
|
|
|
|
in I C<$ixa()> and C<$ixb()>, which is a Good Thing if your are feeding |
113
|
|
|
|
|
|
|
the aligned values into an operation for which missing values are annihilators: |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
$missinga * $bval == ($missinga * $missingb) for each $bval \in $b, and |
116
|
|
|
|
|
|
|
$aval * $missingb == ($missinga * $missingb) for each $aval \in $a |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This ought to be the case for all operations if missing values are C (see L), |
119
|
|
|
|
|
|
|
but might cause unexpected results if e.g. missing values are zero and the operation |
120
|
|
|
|
|
|
|
in question is addition. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=for bad |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
ccs_binop_align_block_mia does not process bad values. |
127
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
*ccs_binop_align_block_mia = \&PDL::ccs_binop_align_block_mia; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
##--------------------------------------------------------------------- |
143
|
|
|
|
|
|
|
=pod |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Perl by Larry Wall. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
PDL by Karl Glazebrook, Tuomas J. Lukka, Christian Soeller, and others. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
##---------------------------------------------------------------------- |
154
|
|
|
|
|
|
|
=pod |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 KNOWN BUGS |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
No support for (pseudo)-threading. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
##--------------------------------------------------------------------- |
164
|
|
|
|
|
|
|
=pod |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 AUTHOR |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Bryan Jurish Emoocow@cpan.orgE |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 Copyright Policy |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
All other parts Copyright (C) 2007-2013, Bryan Jurish. All rights reserved. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
This package is free software, and entirely without warranty. |
175
|
|
|
|
|
|
|
You may redistribute it and/or modify it under the same terms |
176
|
|
|
|
|
|
|
as Perl itself. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 SEE ALSO |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
perl(1), PDL(3perl) |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
# Exit with OK status |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
1; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|