| 1 | # | ||
| 2 | # GENERATED WITH PDL::PP from ccsufunc.pd! Don't modify! | ||
| 3 | # | ||
| 4 | package PDL::CCS::Ufunc; | ||
| 5 | |||
| 6 | 14 | our @EXPORT_OK = qw(ccs_accum_prod ccs_accum_dprod ccs_accum_sum ccs_accum_dsum ccs_accum_or ccs_accum_and ccs_accum_bor ccs_accum_band ccs_accum_maximum ccs_accum_minimum ccs_accum_maximum_nz_ind ccs_accum_minimum_nz_ind ccs_accum_nbad ccs_accum_ngood ccs_accum_nnz ccs_accum_average ); | |
| 7 | 14 | our %EXPORT_TAGS = (Func=>\@EXPORT_OK); | |
| 8 | |||
| 9 | 14 | ▶ | use PDL::Core; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 14 | ▶ | use PDL::Exporter; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 14 | ▶ | use DynaLoader; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | |||
| 14 | 14 | our $VERSION = '1.24.1'; | |
| 15 | 14 | our @ISA = ( 'PDL::Exporter','DynaLoader' ); | |
| 16 | 14 | push @PDL::Core::PP, __PACKAGE__; | |
| 17 | 14 | bootstrap PDL::CCS::Ufunc $VERSION; | |
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | #line 13 "ccsufunc.pd" | ||
| 27 | |||
| 28 | =pod | ||
| 29 | |||
| 30 | =head1 NAME | ||
| 31 | |||
| 32 | PDL::CCS::Ufunc - Ufuncs for compressed storage sparse PDLs | ||
| 33 | |||
| 34 | =head1 SYNOPSIS | ||
| 35 | |||
| 36 | use PDL; | ||
| 37 | use PDL::CCS::Ufunc; | ||
| 38 | |||
| 39 | ##--------------------------------------------------------------------- | ||
| 40 | ## ... stuff happens | ||
| 41 | |||
| 42 | =cut | ||
| 43 | #line 44 "Ufunc.pm" | ||
| 44 | |||
| 45 | |||
| 46 | =head1 FUNCTIONS | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | =head2 ccs_accum_prod | ||
| 56 | |||
| 57 | =for sig | ||
| 58 | |||
| 59 | Signature: ( | ||
| 60 | indx ixIn(Ndims,NnzIn); | ||
| 61 | nzvalsIn(NnzIn); | ||
| 62 | missing(); | ||
| 63 | indx N(); | ||
| 64 | indx [o]ixOut(Ndims,NnzOut); | ||
| 65 | [o]nzvalsOut(NnzOut); | ||
| 66 | indx [o]nOut(); | ||
| 67 | ) | ||
| 68 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 69 | float double ldouble) | ||
| 70 | |||
| 71 | =for usage | ||
| 72 | |||
| 73 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_prod($ixIn, $nzvalsIn, $missing, $N); | ||
| 74 | ccs_accum_prod($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 75 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_prod($nzvalsIn, $missing, $N); # method call | ||
| 76 | $ixIn->ccs_accum_prod($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 77 | |||
| 78 | Accumulated product over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 79 | On return, | ||
| 80 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 81 | $nzvalsOut() holds the associated values, | ||
| 82 | and | ||
| 83 | $nOut() stores the number of unique non-missing values computed. | ||
| 84 | |||
| 85 | If $N() is specified and greater than zero, then the quantity: | ||
| 86 | |||
| 87 | $missing ** ($N - (rlevec($ixIn))[0]) | ||
| 88 | |||
| 89 | is multiplied into $nzvalsOut: this is probably What You Want if you are computing the product over a virtual | ||
| 90 | dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class). | ||
| 91 | |||
| 92 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 93 | |||
| 94 | In scalar context, returns only $nzvalsOut(). | ||
| 95 | |||
| 96 | =pod | ||
| 97 | |||
| 98 | Broadcasts over its inputs. | ||
| 99 | |||
| 100 | =for bad | ||
| 101 | |||
| 102 | C<ccs_accum_prod> processes bad values. | ||
| 103 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | |||
| 111 | sub PDL::ccs_accum_prod { | ||
| 112 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 113 | $nOut //= PDL->null; | ||
| 114 | $ixOut //= PDL->null; | ||
| 115 | $nzvalsOut //= PDL->null; | ||
| 116 | &PDL::_ccs_accum_prod_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 117 | ## | ||
| 118 | ##-- auto-trim | ||
| 119 | my $trim_slice = "0:".($nOut->max-1); | ||
| 120 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 121 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 122 | ## | ||
| 123 | ##-- return | ||
| 124 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 125 | } | ||
| 126 | |||
| 127 | |||
| 128 | |||
| 129 | *ccs_accum_prod = \&PDL::ccs_accum_prod; | ||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | |||
| 136 | =head2 ccs_accum_dprod | ||
| 137 | |||
| 138 | =for sig | ||
| 139 | |||
| 140 | Signature: ( | ||
| 141 | indx ixIn(Ndims,NnzIn); | ||
| 142 | nzvalsIn(NnzIn); | ||
| 143 | missing(); | ||
| 144 | indx N(); | ||
| 145 | indx [o]ixOut(Ndims,NnzOut); | ||
| 146 | double [o]nzvalsOut(NnzOut); | ||
| 147 | indx [o]nOut(); | ||
| 148 | ) | ||
| 149 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 150 | float double ldouble) | ||
| 151 | |||
| 152 | =for usage | ||
| 153 | |||
| 154 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_dprod($ixIn, $nzvalsIn, $missing, $N); | ||
| 155 | ccs_accum_dprod($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 156 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_dprod($nzvalsIn, $missing, $N); # method call | ||
| 157 | $ixIn->ccs_accum_dprod($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 158 | |||
| 159 | Accumulated double-precision product over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 160 | On return, | ||
| 161 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 162 | $nzvalsOut() holds the associated values, | ||
| 163 | and | ||
| 164 | $nOut() stores the number of unique non-missing values computed. | ||
| 165 | |||
| 166 | If $N() is specified and greater than zero, then the quantity: | ||
| 167 | |||
| 168 | $missing ** ($N - (rlevec($ixIn))[0]) | ||
| 169 | |||
| 170 | is multiplied into $nzvalsOut: this is probably What You Want if you are computing the product over a virtual | ||
| 171 | dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class). | ||
| 172 | |||
| 173 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 174 | |||
| 175 | In scalar context, returns only $nzvalsOut(). | ||
| 176 | |||
| 177 | =pod | ||
| 178 | |||
| 179 | Broadcasts over its inputs. | ||
| 180 | |||
| 181 | =for bad | ||
| 182 | |||
| 183 | C<ccs_accum_dprod> processes bad values. | ||
| 184 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 185 | |||
| 186 | =cut | ||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | |||
| 191 | |||
| 192 | sub PDL::ccs_accum_dprod { | ||
| 193 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 194 | $nOut //= PDL->null; | ||
| 195 | $ixOut //= PDL->null; | ||
| 196 | $nzvalsOut //= PDL->null; | ||
| 197 | &PDL::_ccs_accum_dprod_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 198 | ## | ||
| 199 | ##-- auto-trim | ||
| 200 | my $trim_slice = "0:".($nOut->max-1); | ||
| 201 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 202 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 203 | ## | ||
| 204 | ##-- return | ||
| 205 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 206 | } | ||
| 207 | |||
| 208 | |||
| 209 | |||
| 210 | *ccs_accum_dprod = \&PDL::ccs_accum_dprod; | ||
| 211 | |||
| 212 | |||
| 213 | |||
| 214 | |||
| 215 | |||
| 216 | |||
| 217 | =head2 ccs_accum_sum | ||
| 218 | |||
| 219 | =for sig | ||
| 220 | |||
| 221 | Signature: ( | ||
| 222 | indx ixIn(Ndims,NnzIn); | ||
| 223 | nzvalsIn(NnzIn); | ||
| 224 | missing(); | ||
| 225 | indx N(); | ||
| 226 | indx [o]ixOut(Ndims,NnzOut); | ||
| 227 | [o]nzvalsOut(NnzOut); | ||
| 228 | indx [o]nOut(); | ||
| 229 | ) | ||
| 230 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 231 | float double ldouble) | ||
| 232 | |||
| 233 | =for usage | ||
| 234 | |||
| 235 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_sum($ixIn, $nzvalsIn, $missing, $N); | ||
| 236 | ccs_accum_sum($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 237 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_sum($nzvalsIn, $missing, $N); # method call | ||
| 238 | $ixIn->ccs_accum_sum($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 239 | |||
| 240 | Accumulated sum over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 241 | On return, | ||
| 242 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 243 | $nzvalsOut() holds the associated values, | ||
| 244 | and | ||
| 245 | $nOut() stores the number of unique non-missing values computed. | ||
| 246 | |||
| 247 | If $N() is specified and greater than zero, then the quantity: | ||
| 248 | |||
| 249 | $missing * ($N - (rlevec($ixIn))[0]) | ||
| 250 | |||
| 251 | is added to $nzvalsOut: this is probably What You Want if you are summing over a virtual | ||
| 252 | dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class). | ||
| 253 | |||
| 254 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 255 | |||
| 256 | In scalar context, returns only $nzvalsOut(). | ||
| 257 | |||
| 258 | =pod | ||
| 259 | |||
| 260 | Broadcasts over its inputs. | ||
| 261 | |||
| 262 | =for bad | ||
| 263 | |||
| 264 | C<ccs_accum_sum> processes bad values. | ||
| 265 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 266 | |||
| 267 | =cut | ||
| 268 | |||
| 269 | |||
| 270 | |||
| 271 | |||
| 272 | |||
| 273 | sub PDL::ccs_accum_sum { | ||
| 274 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 275 | $nOut //= PDL->null; | ||
| 276 | $ixOut //= PDL->null; | ||
| 277 | $nzvalsOut //= PDL->null; | ||
| 278 | &PDL::_ccs_accum_sum_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 279 | ## | ||
| 280 | ##-- auto-trim | ||
| 281 | my $trim_slice = "0:".($nOut->max-1); | ||
| 282 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 283 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 284 | ## | ||
| 285 | ##-- return | ||
| 286 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 287 | } | ||
| 288 | |||
| 289 | |||
| 290 | |||
| 291 | *ccs_accum_sum = \&PDL::ccs_accum_sum; | ||
| 292 | |||
| 293 | |||
| 294 | |||
| 295 | |||
| 296 | |||
| 297 | |||
| 298 | =head2 ccs_accum_dsum | ||
| 299 | |||
| 300 | =for sig | ||
| 301 | |||
| 302 | Signature: ( | ||
| 303 | indx ixIn(Ndims,NnzIn); | ||
| 304 | nzvalsIn(NnzIn); | ||
| 305 | missing(); | ||
| 306 | indx N(); | ||
| 307 | indx [o]ixOut(Ndims,NnzOut); | ||
| 308 | double [o]nzvalsOut(NnzOut); | ||
| 309 | indx [o]nOut(); | ||
| 310 | ) | ||
| 311 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 312 | float double ldouble) | ||
| 313 | |||
| 314 | =for usage | ||
| 315 | |||
| 316 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_dsum($ixIn, $nzvalsIn, $missing, $N); | ||
| 317 | ccs_accum_dsum($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 318 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_dsum($nzvalsIn, $missing, $N); # method call | ||
| 319 | $ixIn->ccs_accum_dsum($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 320 | |||
| 321 | Accumulated double-precision sum over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 322 | On return, | ||
| 323 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 324 | $nzvalsOut() holds the associated values, | ||
| 325 | and | ||
| 326 | $nOut() stores the number of unique non-missing values computed. | ||
| 327 | |||
| 328 | If $N() is specified and greater than zero, then the quantity: | ||
| 329 | |||
| 330 | $missing * ($N - (rlevec($ixIn))[0]) | ||
| 331 | |||
| 332 | is added to $nzvalsOut: this is probably What You Want if you are summing over a virtual | ||
| 333 | dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class). | ||
| 334 | |||
| 335 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 336 | |||
| 337 | In scalar context, returns only $nzvalsOut(). | ||
| 338 | |||
| 339 | =pod | ||
| 340 | |||
| 341 | Broadcasts over its inputs. | ||
| 342 | |||
| 343 | =for bad | ||
| 344 | |||
| 345 | C<ccs_accum_dsum> processes bad values. | ||
| 346 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 347 | |||
| 348 | =cut | ||
| 349 | |||
| 350 | |||
| 351 | |||
| 352 | |||
| 353 | |||
| 354 | sub PDL::ccs_accum_dsum { | ||
| 355 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 356 | $nOut //= PDL->null; | ||
| 357 | $ixOut //= PDL->null; | ||
| 358 | $nzvalsOut //= PDL->null; | ||
| 359 | &PDL::_ccs_accum_dsum_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 360 | ## | ||
| 361 | ##-- auto-trim | ||
| 362 | my $trim_slice = "0:".($nOut->max-1); | ||
| 363 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 364 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 365 | ## | ||
| 366 | ##-- return | ||
| 367 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 368 | } | ||
| 369 | |||
| 370 | |||
| 371 | |||
| 372 | *ccs_accum_dsum = \&PDL::ccs_accum_dsum; | ||
| 373 | |||
| 374 | |||
| 375 | |||
| 376 | |||
| 377 | |||
| 378 | |||
| 379 | =head2 ccs_accum_or | ||
| 380 | |||
| 381 | =for sig | ||
| 382 | |||
| 383 | Signature: ( | ||
| 384 | indx ixIn(Ndims,NnzIn); | ||
| 385 | nzvalsIn(NnzIn); | ||
| 386 | missing(); | ||
| 387 | indx N(); | ||
| 388 | indx [o]ixOut(Ndims,NnzOut); | ||
| 389 | [o]nzvalsOut(NnzOut); | ||
| 390 | indx [o]nOut(); | ||
| 391 | ) | ||
| 392 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 393 | float double ldouble) | ||
| 394 | |||
| 395 | =for usage | ||
| 396 | |||
| 397 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_or($ixIn, $nzvalsIn, $missing, $N); | ||
| 398 | ccs_accum_or($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 399 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_or($nzvalsIn, $missing, $N); # method call | ||
| 400 | $ixIn->ccs_accum_or($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 401 | |||
| 402 | Accumulated logical "or" over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 403 | On return, | ||
| 404 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 405 | $nzvalsOut() holds the associated values, | ||
| 406 | and | ||
| 407 | $nOut() stores the number of unique non-missing values computed. | ||
| 408 | |||
| 409 | If $N() is specified and greater than zero, $missing() is logically (or)ed | ||
| 410 | into each result value at each output index with a run length of less than $N() in $ixIn(). | ||
| 411 | This is probably What You Want. | ||
| 412 | |||
| 413 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 414 | |||
| 415 | In scalar context, returns only $nzvalsOut(). | ||
| 416 | |||
| 417 | =pod | ||
| 418 | |||
| 419 | Broadcasts over its inputs. | ||
| 420 | |||
| 421 | =for bad | ||
| 422 | |||
| 423 | C<ccs_accum_or> processes bad values. | ||
| 424 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 425 | |||
| 426 | =cut | ||
| 427 | |||
| 428 | |||
| 429 | |||
| 430 | |||
| 431 | |||
| 432 | sub PDL::ccs_accum_or { | ||
| 433 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 434 | $nOut //= PDL->null; | ||
| 435 | $ixOut //= PDL->null; | ||
| 436 | $nzvalsOut //= PDL->null; | ||
| 437 | &PDL::_ccs_accum_or_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 438 | ## | ||
| 439 | ##-- auto-trim | ||
| 440 | my $trim_slice = "0:".($nOut->max-1); | ||
| 441 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 442 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 443 | ## | ||
| 444 | ##-- return | ||
| 445 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 446 | } | ||
| 447 | |||
| 448 | |||
| 449 | |||
| 450 | *ccs_accum_or = \&PDL::ccs_accum_or; | ||
| 451 | |||
| 452 | |||
| 453 | |||
| 454 | |||
| 455 | |||
| 456 | |||
| 457 | =head2 ccs_accum_and | ||
| 458 | |||
| 459 | =for sig | ||
| 460 | |||
| 461 | Signature: ( | ||
| 462 | indx ixIn(Ndims,NnzIn); | ||
| 463 | nzvalsIn(NnzIn); | ||
| 464 | missing(); | ||
| 465 | indx N(); | ||
| 466 | indx [o]ixOut(Ndims,NnzOut); | ||
| 467 | [o]nzvalsOut(NnzOut); | ||
| 468 | indx [o]nOut(); | ||
| 469 | ) | ||
| 470 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 471 | float double ldouble) | ||
| 472 | |||
| 473 | =for usage | ||
| 474 | |||
| 475 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_and($ixIn, $nzvalsIn, $missing, $N); | ||
| 476 | ccs_accum_and($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 477 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_and($nzvalsIn, $missing, $N); # method call | ||
| 478 | $ixIn->ccs_accum_and($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 479 | |||
| 480 | Accumulated logical "and" over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 481 | On return, | ||
| 482 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 483 | $nzvalsOut() holds the associated values, | ||
| 484 | and | ||
| 485 | $nOut() stores the number of unique non-missing values computed. | ||
| 486 | |||
| 487 | If $N() is specified and greater than zero, $missing() is logically (and)ed | ||
| 488 | into each result value at each output index with a run length of less than $N() in $ixIn(). | ||
| 489 | This is probably What You Want. | ||
| 490 | |||
| 491 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 492 | |||
| 493 | In scalar context, returns only $nzvalsOut(). | ||
| 494 | |||
| 495 | =pod | ||
| 496 | |||
| 497 | Broadcasts over its inputs. | ||
| 498 | |||
| 499 | =for bad | ||
| 500 | |||
| 501 | C<ccs_accum_and> processes bad values. | ||
| 502 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 503 | |||
| 504 | =cut | ||
| 505 | |||
| 506 | |||
| 507 | |||
| 508 | |||
| 509 | |||
| 510 | sub PDL::ccs_accum_and { | ||
| 511 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 512 | $nOut //= PDL->null; | ||
| 513 | $ixOut //= PDL->null; | ||
| 514 | $nzvalsOut //= PDL->null; | ||
| 515 | &PDL::_ccs_accum_and_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 516 | ## | ||
| 517 | ##-- auto-trim | ||
| 518 | my $trim_slice = "0:".($nOut->max-1); | ||
| 519 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 520 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 521 | ## | ||
| 522 | ##-- return | ||
| 523 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 524 | } | ||
| 525 | |||
| 526 | |||
| 527 | |||
| 528 | *ccs_accum_and = \&PDL::ccs_accum_and; | ||
| 529 | |||
| 530 | |||
| 531 | |||
| 532 | |||
| 533 | |||
| 534 | |||
| 535 | =head2 ccs_accum_bor | ||
| 536 | |||
| 537 | =for sig | ||
| 538 | |||
| 539 | Signature: ( | ||
| 540 | indx ixIn(Ndims,NnzIn); | ||
| 541 | nzvalsIn(NnzIn); | ||
| 542 | missing(); | ||
| 543 | indx N(); | ||
| 544 | indx [o]ixOut(Ndims,NnzOut); | ||
| 545 | [o]nzvalsOut(NnzOut); | ||
| 546 | indx [o]nOut(); | ||
| 547 | ) | ||
| 548 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong) | ||
| 549 | |||
| 550 | =for usage | ||
| 551 | |||
| 552 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_bor($ixIn, $nzvalsIn, $missing, $N); | ||
| 553 | ccs_accum_bor($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 554 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_bor($nzvalsIn, $missing, $N); # method call | ||
| 555 | $ixIn->ccs_accum_bor($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 556 | |||
| 557 | Accumulated bitwise "or" over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 558 | On return, | ||
| 559 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 560 | $nzvalsOut() holds the associated values, | ||
| 561 | and | ||
| 562 | $nOut() stores the number of unique non-missing values computed. | ||
| 563 | |||
| 564 | If $N() is specified and greater than zero, $missing() is bitwise (or)ed | ||
| 565 | into each result value at each output index with a run length of less than $N() in $ixIn(). | ||
| 566 | This is probably What You Want. | ||
| 567 | |||
| 568 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 569 | |||
| 570 | In scalar context, returns only $nzvalsOut(). | ||
| 571 | |||
| 572 | =pod | ||
| 573 | |||
| 574 | Broadcasts over its inputs. | ||
| 575 | |||
| 576 | =for bad | ||
| 577 | |||
| 578 | C<ccs_accum_bor> processes bad values. | ||
| 579 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 580 | |||
| 581 | =cut | ||
| 582 | |||
| 583 | |||
| 584 | |||
| 585 | |||
| 586 | |||
| 587 | sub PDL::ccs_accum_bor { | ||
| 588 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 589 | $nOut //= PDL->null; | ||
| 590 | $ixOut //= PDL->null; | ||
| 591 | $nzvalsOut //= PDL->null; | ||
| 592 | &PDL::_ccs_accum_bor_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 593 | ## | ||
| 594 | ##-- auto-trim | ||
| 595 | my $trim_slice = "0:".($nOut->max-1); | ||
| 596 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 597 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 598 | ## | ||
| 599 | ##-- return | ||
| 600 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 601 | } | ||
| 602 | |||
| 603 | |||
| 604 | |||
| 605 | *ccs_accum_bor = \&PDL::ccs_accum_bor; | ||
| 606 | |||
| 607 | |||
| 608 | |||
| 609 | |||
| 610 | |||
| 611 | |||
| 612 | =head2 ccs_accum_band | ||
| 613 | |||
| 614 | =for sig | ||
| 615 | |||
| 616 | Signature: ( | ||
| 617 | indx ixIn(Ndims,NnzIn); | ||
| 618 | nzvalsIn(NnzIn); | ||
| 619 | missing(); | ||
| 620 | indx N(); | ||
| 621 | indx [o]ixOut(Ndims,NnzOut); | ||
| 622 | [o]nzvalsOut(NnzOut); | ||
| 623 | indx [o]nOut(); | ||
| 624 | ) | ||
| 625 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong) | ||
| 626 | |||
| 627 | =for usage | ||
| 628 | |||
| 629 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_band($ixIn, $nzvalsIn, $missing, $N); | ||
| 630 | ccs_accum_band($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 631 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_band($nzvalsIn, $missing, $N); # method call | ||
| 632 | $ixIn->ccs_accum_band($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 633 | |||
| 634 | Accumulated bitwise "and" over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 635 | On return, | ||
| 636 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 637 | $nzvalsOut() holds the associated values, | ||
| 638 | and | ||
| 639 | $nOut() stores the number of unique non-missing values computed. | ||
| 640 | |||
| 641 | If $N() is specified and greater than zero, $missing() is bitwise (and)ed | ||
| 642 | into each result value at each output index with a run length of less than $N() in $ixIn(). | ||
| 643 | This is probably What You Want. | ||
| 644 | |||
| 645 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 646 | |||
| 647 | In scalar context, returns only $nzvalsOut(). | ||
| 648 | |||
| 649 | =pod | ||
| 650 | |||
| 651 | Broadcasts over its inputs. | ||
| 652 | |||
| 653 | =for bad | ||
| 654 | |||
| 655 | C<ccs_accum_band> processes bad values. | ||
| 656 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 657 | |||
| 658 | =cut | ||
| 659 | |||
| 660 | |||
| 661 | |||
| 662 | |||
| 663 | |||
| 664 | sub PDL::ccs_accum_band { | ||
| 665 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 666 | $nOut //= PDL->null; | ||
| 667 | $ixOut //= PDL->null; | ||
| 668 | $nzvalsOut //= PDL->null; | ||
| 669 | &PDL::_ccs_accum_band_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 670 | ## | ||
| 671 | ##-- auto-trim | ||
| 672 | my $trim_slice = "0:".($nOut->max-1); | ||
| 673 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 674 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 675 | ## | ||
| 676 | ##-- return | ||
| 677 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 678 | } | ||
| 679 | |||
| 680 | |||
| 681 | |||
| 682 | *ccs_accum_band = \&PDL::ccs_accum_band; | ||
| 683 | |||
| 684 | |||
| 685 | |||
| 686 | |||
| 687 | |||
| 688 | |||
| 689 | =head2 ccs_accum_maximum | ||
| 690 | |||
| 691 | =for sig | ||
| 692 | |||
| 693 | Signature: ( | ||
| 694 | indx ixIn(Ndims,NnzIn); | ||
| 695 | nzvalsIn(NnzIn); | ||
| 696 | missing(); | ||
| 697 | indx N(); | ||
| 698 | indx [o]ixOut(Ndims,NnzOut); | ||
| 699 | [o]nzvalsOut(NnzOut); | ||
| 700 | indx [o]nOut(); | ||
| 701 | ) | ||
| 702 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 703 | float double ldouble) | ||
| 704 | |||
| 705 | =for usage | ||
| 706 | |||
| 707 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_maximum($ixIn, $nzvalsIn, $missing, $N); | ||
| 708 | ccs_accum_maximum($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 709 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_maximum($nzvalsIn, $missing, $N); # method call | ||
| 710 | $ixIn->ccs_accum_maximum($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 711 | |||
| 712 | Accumulated maximum over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 713 | On return, | ||
| 714 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 715 | $nzvalsOut() holds the associated values, | ||
| 716 | and | ||
| 717 | $nOut() stores the number of unique non-missing values computed. | ||
| 718 | |||
| 719 | If $N() is specified and greater than zero, | ||
| 720 | and if $missing() is greater than any listed value for a vector key with a run-length | ||
| 721 | of less than $N(), then $missing() is used as the output value for that key. | ||
| 722 | This is probably What You Want. | ||
| 723 | |||
| 724 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 725 | |||
| 726 | In scalar context, returns only $nzvalsOut(). | ||
| 727 | |||
| 728 | =pod | ||
| 729 | |||
| 730 | Broadcasts over its inputs. | ||
| 731 | |||
| 732 | =for bad | ||
| 733 | |||
| 734 | C<ccs_accum_maximum> processes bad values. | ||
| 735 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 736 | |||
| 737 | =cut | ||
| 738 | |||
| 739 | |||
| 740 | |||
| 741 | |||
| 742 | |||
| 743 | sub PDL::ccs_accum_maximum { | ||
| 744 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 745 | $nOut //= PDL->null; | ||
| 746 | $ixOut //= PDL->null; | ||
| 747 | $nzvalsOut //= PDL->null; | ||
| 748 | &PDL::_ccs_accum_maximum_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 749 | ## | ||
| 750 | ##-- auto-trim | ||
| 751 | my $trim_slice = "0:".($nOut->max-1); | ||
| 752 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 753 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 754 | ## | ||
| 755 | ##-- return | ||
| 756 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 757 | } | ||
| 758 | |||
| 759 | |||
| 760 | |||
| 761 | *ccs_accum_maximum = \&PDL::ccs_accum_maximum; | ||
| 762 | |||
| 763 | |||
| 764 | |||
| 765 | |||
| 766 | |||
| 767 | |||
| 768 | =head2 ccs_accum_minimum | ||
| 769 | |||
| 770 | =for sig | ||
| 771 | |||
| 772 | Signature: ( | ||
| 773 | indx ixIn(Ndims,NnzIn); | ||
| 774 | nzvalsIn(NnzIn); | ||
| 775 | missing(); | ||
| 776 | indx N(); | ||
| 777 | indx [o]ixOut(Ndims,NnzOut); | ||
| 778 | [o]nzvalsOut(NnzOut); | ||
| 779 | indx [o]nOut(); | ||
| 780 | ) | ||
| 781 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 782 | float double ldouble) | ||
| 783 | |||
| 784 | =for usage | ||
| 785 | |||
| 786 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_minimum($ixIn, $nzvalsIn, $missing, $N); | ||
| 787 | ccs_accum_minimum($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 788 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_minimum($nzvalsIn, $missing, $N); # method call | ||
| 789 | $ixIn->ccs_accum_minimum($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 790 | |||
| 791 | Accumulated minimum over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 792 | On return, | ||
| 793 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 794 | $nzvalsOut() holds the associated values, | ||
| 795 | and | ||
| 796 | $nOut() stores the number of unique non-missing values computed. | ||
| 797 | |||
| 798 | If $N() is specified and greater than zero, | ||
| 799 | and if $missing() is less than any listed value for a vector key with a run-length | ||
| 800 | of less than $N(), then $missing() is used as the output value for that key. | ||
| 801 | This is probably What You Want. | ||
| 802 | |||
| 803 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 804 | |||
| 805 | In scalar context, returns only $nzvalsOut(). | ||
| 806 | |||
| 807 | =pod | ||
| 808 | |||
| 809 | Broadcasts over its inputs. | ||
| 810 | |||
| 811 | =for bad | ||
| 812 | |||
| 813 | C<ccs_accum_minimum> processes bad values. | ||
| 814 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 815 | |||
| 816 | =cut | ||
| 817 | |||
| 818 | |||
| 819 | |||
| 820 | |||
| 821 | |||
| 822 | sub PDL::ccs_accum_minimum { | ||
| 823 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 824 | $nOut //= PDL->null; | ||
| 825 | $ixOut //= PDL->null; | ||
| 826 | $nzvalsOut //= PDL->null; | ||
| 827 | &PDL::_ccs_accum_minimum_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 828 | ## | ||
| 829 | ##-- auto-trim | ||
| 830 | my $trim_slice = "0:".($nOut->max-1); | ||
| 831 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 832 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 833 | ## | ||
| 834 | ##-- return | ||
| 835 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 836 | } | ||
| 837 | |||
| 838 | |||
| 839 | |||
| 840 | *ccs_accum_minimum = \&PDL::ccs_accum_minimum; | ||
| 841 | |||
| 842 | |||
| 843 | |||
| 844 | |||
| 845 | |||
| 846 | |||
| 847 | =head2 ccs_accum_maximum_nz_ind | ||
| 848 | |||
| 849 | =for sig | ||
| 850 | |||
| 851 | Signature: ( | ||
| 852 | indx ixIn(Ndims,NnzIn); | ||
| 853 | nzvalsIn(NnzIn); | ||
| 854 | missing(); | ||
| 855 | indx N(); | ||
| 856 | indx [o]ixOut(Ndims,NnzOut); | ||
| 857 | indx [o]nzvalsOut(NnzOut); | ||
| 858 | indx [o]nOut(); | ||
| 859 | ) | ||
| 860 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 861 | float double ldouble) | ||
| 862 | |||
| 863 | =for usage | ||
| 864 | |||
| 865 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_maximum_nz_ind($ixIn, $nzvalsIn, $missing, $N); | ||
| 866 | ccs_accum_maximum_nz_ind($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 867 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_maximum_nz_ind($nzvalsIn, $missing, $N); # method call | ||
| 868 | $ixIn->ccs_accum_maximum_nz_ind($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 869 | |||
| 870 | Accumulated maximum_nz_ind over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 871 | On return, | ||
| 872 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 873 | $nzvalsOut() holds the associated values, | ||
| 874 | and | ||
| 875 | $nOut() stores the number of unique non-missing values computed. | ||
| 876 | |||
| 877 | Output indices index $nzvalsIn, -1 indicates that the missing value is maximal. | ||
| 878 | |||
| 879 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 880 | |||
| 881 | In scalar context, returns only $nzvalsOut(). | ||
| 882 | |||
| 883 | =pod | ||
| 884 | |||
| 885 | Broadcasts over its inputs. | ||
| 886 | |||
| 887 | =for bad | ||
| 888 | |||
| 889 | C<ccs_accum_maximum_nz_ind> processes bad values. | ||
| 890 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 891 | |||
| 892 | =cut | ||
| 893 | |||
| 894 | |||
| 895 | |||
| 896 | |||
| 897 | |||
| 898 | sub PDL::ccs_accum_maximum_nz_ind { | ||
| 899 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 900 | $nOut //= PDL->null; | ||
| 901 | $ixOut //= PDL->null; | ||
| 902 | $nzvalsOut //= PDL->null; | ||
| 903 | &PDL::_ccs_accum_maximum_nz_ind_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 904 | ## | ||
| 905 | ##-- auto-trim | ||
| 906 | my $trim_slice = "0:".($nOut->max-1); | ||
| 907 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 908 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 909 | ## | ||
| 910 | ##-- return | ||
| 911 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 912 | } | ||
| 913 | |||
| 914 | |||
| 915 | |||
| 916 | *ccs_accum_maximum_nz_ind = \&PDL::ccs_accum_maximum_nz_ind; | ||
| 917 | |||
| 918 | |||
| 919 | |||
| 920 | |||
| 921 | |||
| 922 | |||
| 923 | =head2 ccs_accum_minimum_nz_ind | ||
| 924 | |||
| 925 | =for sig | ||
| 926 | |||
| 927 | Signature: ( | ||
| 928 | indx ixIn(Ndims,NnzIn); | ||
| 929 | nzvalsIn(NnzIn); | ||
| 930 | missing(); | ||
| 931 | indx N(); | ||
| 932 | indx [o]ixOut(Ndims,NnzOut); | ||
| 933 | indx [o]nzvalsOut(NnzOut); | ||
| 934 | indx [o]nOut(); | ||
| 935 | ) | ||
| 936 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 937 | float double ldouble) | ||
| 938 | |||
| 939 | =for usage | ||
| 940 | |||
| 941 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_minimum_nz_ind($ixIn, $nzvalsIn, $missing, $N); | ||
| 942 | ccs_accum_minimum_nz_ind($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 943 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_minimum_nz_ind($nzvalsIn, $missing, $N); # method call | ||
| 944 | $ixIn->ccs_accum_minimum_nz_ind($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 945 | |||
| 946 | Accumulated minimum_nz_ind over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 947 | On return, | ||
| 948 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 949 | $nzvalsOut() holds the associated values, | ||
| 950 | and | ||
| 951 | $nOut() stores the number of unique non-missing values computed. | ||
| 952 | |||
| 953 | Output indices index $nzvalsIn, -1 indicates that the missing value is minimal. | ||
| 954 | |||
| 955 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 956 | |||
| 957 | In scalar context, returns only $nzvalsOut(). | ||
| 958 | |||
| 959 | =pod | ||
| 960 | |||
| 961 | Broadcasts over its inputs. | ||
| 962 | |||
| 963 | =for bad | ||
| 964 | |||
| 965 | C<ccs_accum_minimum_nz_ind> processes bad values. | ||
| 966 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 967 | |||
| 968 | =cut | ||
| 969 | |||
| 970 | |||
| 971 | |||
| 972 | |||
| 973 | |||
| 974 | sub PDL::ccs_accum_minimum_nz_ind { | ||
| 975 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 976 | $nOut //= PDL->null; | ||
| 977 | $ixOut //= PDL->null; | ||
| 978 | $nzvalsOut //= PDL->null; | ||
| 979 | &PDL::_ccs_accum_minimum_nz_ind_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 980 | ## | ||
| 981 | ##-- auto-trim | ||
| 982 | my $trim_slice = "0:".($nOut->max-1); | ||
| 983 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 984 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 985 | ## | ||
| 986 | ##-- return | ||
| 987 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 988 | } | ||
| 989 | |||
| 990 | |||
| 991 | |||
| 992 | *ccs_accum_minimum_nz_ind = \&PDL::ccs_accum_minimum_nz_ind; | ||
| 993 | |||
| 994 | |||
| 995 | |||
| 996 | |||
| 997 | |||
| 998 | |||
| 999 | =head2 ccs_accum_nbad | ||
| 1000 | |||
| 1001 | =for sig | ||
| 1002 | |||
| 1003 | Signature: ( | ||
| 1004 | indx ixIn(Ndims,NnzIn); | ||
| 1005 | nzvalsIn(NnzIn); | ||
| 1006 | missing(); | ||
| 1007 | indx N(); | ||
| 1008 | indx [o]ixOut(Ndims,NnzOut); | ||
| 1009 | indx [o]nzvalsOut(NnzOut); | ||
| 1010 | indx [o]nOut(); | ||
| 1011 | ) | ||
| 1012 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 1013 | float double ldouble) | ||
| 1014 | |||
| 1015 | =for usage | ||
| 1016 | |||
| 1017 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_nbad($ixIn, $nzvalsIn, $missing, $N); | ||
| 1018 | ccs_accum_nbad($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 1019 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_nbad($nzvalsIn, $missing, $N); # method call | ||
| 1020 | $ixIn->ccs_accum_nbad($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 1021 | |||
| 1022 | Accumulated number of bad values over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 1023 | On return, | ||
| 1024 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 1025 | $nzvalsOut() holds the associated values, | ||
| 1026 | and | ||
| 1027 | $nOut() stores the number of unique non-missing values computed. | ||
| 1028 | |||
| 1029 | Should handle missing values appropriately. | ||
| 1030 | |||
| 1031 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 1032 | |||
| 1033 | In scalar context, returns only $nzvalsOut(). | ||
| 1034 | |||
| 1035 | =pod | ||
| 1036 | |||
| 1037 | Broadcasts over its inputs. | ||
| 1038 | |||
| 1039 | =for bad | ||
| 1040 | |||
| 1041 | C<ccs_accum_nbad> processes bad values. | ||
| 1042 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 1043 | |||
| 1044 | =cut | ||
| 1045 | |||
| 1046 | |||
| 1047 | |||
| 1048 | |||
| 1049 | |||
| 1050 | sub PDL::ccs_accum_nbad { | ||
| 1051 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 1052 | $nOut //= PDL->null; | ||
| 1053 | $ixOut //= PDL->null; | ||
| 1054 | $nzvalsOut //= PDL->null; | ||
| 1055 | &PDL::_ccs_accum_nbad_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 1056 | ## | ||
| 1057 | ##-- auto-trim | ||
| 1058 | my $trim_slice = "0:".($nOut->max-1); | ||
| 1059 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 1060 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 1061 | ## | ||
| 1062 | ##-- return | ||
| 1063 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | |||
| 1067 | |||
| 1068 | *ccs_accum_nbad = \&PDL::ccs_accum_nbad; | ||
| 1069 | |||
| 1070 | |||
| 1071 | |||
| 1072 | |||
| 1073 | |||
| 1074 | |||
| 1075 | =head2 ccs_accum_ngood | ||
| 1076 | |||
| 1077 | =for sig | ||
| 1078 | |||
| 1079 | Signature: ( | ||
| 1080 | indx ixIn(Ndims,NnzIn); | ||
| 1081 | nzvalsIn(NnzIn); | ||
| 1082 | missing(); | ||
| 1083 | indx N(); | ||
| 1084 | indx [o]ixOut(Ndims,NnzOut); | ||
| 1085 | indx [o]nzvalsOut(NnzOut); | ||
| 1086 | indx [o]nOut(); | ||
| 1087 | ) | ||
| 1088 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 1089 | float double ldouble) | ||
| 1090 | |||
| 1091 | =for usage | ||
| 1092 | |||
| 1093 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_ngood($ixIn, $nzvalsIn, $missing, $N); | ||
| 1094 | ccs_accum_ngood($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 1095 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_ngood($nzvalsIn, $missing, $N); # method call | ||
| 1096 | $ixIn->ccs_accum_ngood($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 1097 | |||
| 1098 | Accumulated number of good values over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 1099 | On return, | ||
| 1100 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 1101 | $nzvalsOut() holds the associated values, | ||
| 1102 | and | ||
| 1103 | $nOut() stores the number of unique non-missing values computed. | ||
| 1104 | |||
| 1105 | Should handle missing values appropriately. | ||
| 1106 | |||
| 1107 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 1108 | |||
| 1109 | In scalar context, returns only $nzvalsOut(). | ||
| 1110 | |||
| 1111 | =pod | ||
| 1112 | |||
| 1113 | Broadcasts over its inputs. | ||
| 1114 | |||
| 1115 | =for bad | ||
| 1116 | |||
| 1117 | C<ccs_accum_ngood> processes bad values. | ||
| 1118 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 1119 | |||
| 1120 | =cut | ||
| 1121 | |||
| 1122 | |||
| 1123 | |||
| 1124 | |||
| 1125 | |||
| 1126 | sub PDL::ccs_accum_ngood { | ||
| 1127 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 1128 | $nOut //= PDL->null; | ||
| 1129 | $ixOut //= PDL->null; | ||
| 1130 | $nzvalsOut //= PDL->null; | ||
| 1131 | &PDL::_ccs_accum_ngood_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 1132 | ## | ||
| 1133 | ##-- auto-trim | ||
| 1134 | my $trim_slice = "0:".($nOut->max-1); | ||
| 1135 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 1136 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 1137 | ## | ||
| 1138 | ##-- return | ||
| 1139 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 1140 | } | ||
| 1141 | |||
| 1142 | |||
| 1143 | |||
| 1144 | *ccs_accum_ngood = \&PDL::ccs_accum_ngood; | ||
| 1145 | |||
| 1146 | |||
| 1147 | |||
| 1148 | |||
| 1149 | |||
| 1150 | |||
| 1151 | =head2 ccs_accum_nnz | ||
| 1152 | |||
| 1153 | =for sig | ||
| 1154 | |||
| 1155 | Signature: ( | ||
| 1156 | indx ixIn(Ndims,NnzIn); | ||
| 1157 | nzvalsIn(NnzIn); | ||
| 1158 | missing(); | ||
| 1159 | indx N(); | ||
| 1160 | indx [o]ixOut(Ndims,NnzOut); | ||
| 1161 | indx [o]nzvalsOut(NnzOut); | ||
| 1162 | indx [o]nOut(); | ||
| 1163 | ) | ||
| 1164 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 1165 | float double ldouble) | ||
| 1166 | |||
| 1167 | =for usage | ||
| 1168 | |||
| 1169 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_nnz($ixIn, $nzvalsIn, $missing, $N); | ||
| 1170 | ccs_accum_nnz($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 1171 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_nnz($nzvalsIn, $missing, $N); # method call | ||
| 1172 | $ixIn->ccs_accum_nnz($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 1173 | |||
| 1174 | Accumulated number of non-zero values over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 1175 | On return, | ||
| 1176 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 1177 | $nzvalsOut() holds the associated values, | ||
| 1178 | and | ||
| 1179 | $nOut() stores the number of unique non-missing values computed. | ||
| 1180 | |||
| 1181 | Should handle missing values appropriately. | ||
| 1182 | |||
| 1183 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 1184 | |||
| 1185 | In scalar context, returns only $nzvalsOut(). | ||
| 1186 | |||
| 1187 | =pod | ||
| 1188 | |||
| 1189 | Broadcasts over its inputs. | ||
| 1190 | |||
| 1191 | =for bad | ||
| 1192 | |||
| 1193 | C<ccs_accum_nnz> processes bad values. | ||
| 1194 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 1195 | |||
| 1196 | =cut | ||
| 1197 | |||
| 1198 | |||
| 1199 | |||
| 1200 | |||
| 1201 | |||
| 1202 | sub PDL::ccs_accum_nnz { | ||
| 1203 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 1204 | $nOut //= PDL->null; | ||
| 1205 | $ixOut //= PDL->null; | ||
| 1206 | $nzvalsOut //= PDL->null; | ||
| 1207 | &PDL::_ccs_accum_nnz_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 1208 | ## | ||
| 1209 | ##-- auto-trim | ||
| 1210 | my $trim_slice = "0:".($nOut->max-1); | ||
| 1211 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 1212 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 1213 | ## | ||
| 1214 | ##-- return | ||
| 1215 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 1216 | } | ||
| 1217 | |||
| 1218 | |||
| 1219 | |||
| 1220 | *ccs_accum_nnz = \&PDL::ccs_accum_nnz; | ||
| 1221 | |||
| 1222 | |||
| 1223 | |||
| 1224 | |||
| 1225 | |||
| 1226 | |||
| 1227 | =head2 ccs_accum_average | ||
| 1228 | |||
| 1229 | =for sig | ||
| 1230 | |||
| 1231 | Signature: ( | ||
| 1232 | indx ixIn(Ndims,NnzIn); | ||
| 1233 | nzvalsIn(NnzIn); | ||
| 1234 | missing(); | ||
| 1235 | indx N(); | ||
| 1236 | indx [o]ixOut(Ndims,NnzOut); | ||
| 1237 | float+ [o]nzvalsOut(NnzOut); | ||
| 1238 | indx [o]nOut(); | ||
| 1239 | ) | ||
| 1240 | Types: (sbyte byte short ushort long ulong indx ulonglong longlong | ||
| 1241 | float double ldouble) | ||
| 1242 | |||
| 1243 | =for usage | ||
| 1244 | |||
| 1245 | ($ixOut, $nzvalsOut, $nOut) = ccs_accum_average($ixIn, $nzvalsIn, $missing, $N); | ||
| 1246 | ccs_accum_average($ixIn, $nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); # all arguments given | ||
| 1247 | ($ixOut, $nzvalsOut, $nOut) = $ixIn->ccs_accum_average($nzvalsIn, $missing, $N); # method call | ||
| 1248 | $ixIn->ccs_accum_average($nzvalsIn, $missing, $N, $ixOut, $nzvalsOut, $nOut); | ||
| 1249 | |||
| 1250 | Accumulated average over values $nzvalsIn() associated with non-missing vector-valued keys $ixIn(). | ||
| 1251 | On return, | ||
| 1252 | $ixOut() holds the unique non-"missing" values of $ixIn(), | ||
| 1253 | $nzvalsOut() holds the associated values, | ||
| 1254 | and | ||
| 1255 | $nOut() stores the number of unique non-missing values computed. | ||
| 1256 | |||
| 1257 | If $N() is specified and greater than zero, then the quantity: | ||
| 1258 | |||
| 1259 | $missing * ($N - (rlevec($ixIn))[0]) / $N | ||
| 1260 | |||
| 1261 | is added to $nzvalsOut: this is probably What You Want if you are averaging over a virtual | ||
| 1262 | dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class). | ||
| 1263 | |||
| 1264 | Returned PDLs are implicitly sliced such that NnzOut==$nOut(). | ||
| 1265 | |||
| 1266 | In scalar context, returns only $nzvalsOut(). | ||
| 1267 | |||
| 1268 | =pod | ||
| 1269 | |||
| 1270 | Broadcasts over its inputs. | ||
| 1271 | |||
| 1272 | =for bad | ||
| 1273 | |||
| 1274 | C<ccs_accum_average> processes bad values. | ||
| 1275 | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | ||
| 1276 | |||
| 1277 | =cut | ||
| 1278 | |||
| 1279 | |||
| 1280 | |||
| 1281 | |||
| 1282 | |||
| 1283 | sub PDL::ccs_accum_average { | ||
| 1284 | my ($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut) = @_; | ||
| 1285 | $nOut //= PDL->null; | ||
| 1286 | $ixOut //= PDL->null; | ||
| 1287 | $nzvalsOut //= PDL->null; | ||
| 1288 | &PDL::_ccs_accum_average_int($ixIn,$nzvalsIn, $missing,$N, $ixOut,$nzvalsOut,$nOut); | ||
| 1289 | ## | ||
| 1290 | ##-- auto-trim | ||
| 1291 | my $trim_slice = "0:".($nOut->max-1); | ||
| 1292 | $ixOut = $ixOut->slice(",$trim_slice"); | ||
| 1293 | $nzvalsOut = $nzvalsOut->slice($trim_slice); | ||
| 1294 | ## | ||
| 1295 | ##-- return | ||
| 1296 | return wantarray ? ($ixOut,$nzvalsOut,$nOut) : $nzvalsOut; | ||
| 1297 | } | ||
| 1298 | |||
| 1299 | |||
| 1300 | |||
| 1301 | *ccs_accum_average = \&PDL::ccs_accum_average; | ||
| 1302 | |||
| 1303 | |||
| 1304 | |||
| 1305 | |||
| 1306 | |||
| 1307 | #line 558 "ccsufunc.pd" | ||
| 1308 | |||
| 1309 | =pod | ||
| 1310 | |||
| 1311 | =head1 TODO / NOT YET IMPLEMENTED | ||
| 1312 | |||
| 1313 | =over 4 | ||
| 1314 | |||
| 1315 | =item extrema indices | ||
| 1316 | |||
| 1317 | maximum_ind, minimum_ind: not quite compatible... | ||
| 1318 | |||
| 1319 | =item statistical aggregates | ||
| 1320 | |||
| 1321 | daverage, medover, oddmedover, pctover, ... | ||
| 1322 | |||
| 1323 | =item cumulative functions | ||
| 1324 | |||
| 1325 | cumusumover, cumuprodover, ... | ||
| 1326 | |||
| 1327 | =item other stuff | ||
| 1328 | |||
| 1329 | zcover, intover, minmaximum | ||
| 1330 | |||
| 1331 | =back | ||
| 1332 | |||
| 1333 | =cut | ||
| 1334 | |||
| 1335 | #line 594 "ccsufunc.pd" | ||
| 1336 | ##--------------------------------------------------------------------- | ||
| 1337 | =pod | ||
| 1338 | |||
| 1339 | =head1 ACKNOWLEDGEMENTS | ||
| 1340 | |||
| 1341 | Perl by Larry Wall. | ||
| 1342 | |||
| 1343 | PDL by Karl Glazebrook, Tuomas J. Lukka, Christian Soeller, and others. | ||
| 1344 | |||
| 1345 | =cut | ||
| 1346 | |||
| 1347 | ##---------------------------------------------------------------------- | ||
| 1348 | =pod | ||
| 1349 | |||
| 1350 | =head1 KNOWN BUGS | ||
| 1351 | |||
| 1352 | Probably many. | ||
| 1353 | |||
| 1354 | =cut | ||
| 1355 | |||
| 1356 | ##--------------------------------------------------------------------- | ||
| 1357 | =pod | ||
| 1358 | |||
| 1359 | =head1 AUTHOR | ||
| 1360 | |||
| 1361 | Bryan Jurish E<lt>moocow@cpan.orgE<gt> | ||
| 1362 | |||
| 1363 | =head2 Copyright Policy | ||
| 1364 | |||
| 1365 | Copyright (C) 2007-2024, Bryan Jurish. All rights reserved. | ||
| 1366 | |||
| 1367 | This package is free software, and entirely without warranty. | ||
| 1368 | You may redistribute it and/or modify it under the same terms | ||
| 1369 | as Perl itself. | ||
| 1370 | |||
| 1371 | =head1 SEE ALSO | ||
| 1372 | |||
| 1373 | perl(1), PDL(3perl) | ||
| 1374 | |||
| 1375 | =cut | ||
| 1376 | #line 1377 "Ufunc.pm" | ||
| 1377 | |||
| 1378 | # Exit with OK status | ||
| 1379 | |||
| 1380 | 1; | ||