NAME

PDL::CCS::Ufunc - Ufuncs for compressed storage sparse PDLs

SYNOPSIS

use PDL;
use PDL::CCS::Ufunc;

##---------------------------------------------------------------------
## ... stuff happens

FUNCTIONS

ccs_accum_prod

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated product over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, then the quantity:

$missing ** ($N - (rlevec($ixIn))[0])

is multiplied into $nzvalsOut: this is probably What You Want if you are computing the product over a virtual dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class).

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_prod processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_dprod

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  double [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated double-precision product over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, then the quantity:

$missing ** ($N - (rlevec($ixIn))[0])

is multiplied into $nzvalsOut: this is probably What You Want if you are computing the product over a virtual dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class).

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_dprod processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_sum

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated sum over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, then the quantity:

$missing * ($N - (rlevec($ixIn))[0])

is added to $nzvalsOut: this is probably What You Want if you are summing over a virtual dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class).

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_sum processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_dsum

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  double [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated double-precision sum over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, then the quantity:

$missing * ($N - (rlevec($ixIn))[0])

is added to $nzvalsOut: this is probably What You Want if you are summing over a virtual dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class).

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_dsum processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_or

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated logical "or" over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, $missing() is logically (or)ed into each result value at each output index with a run length of less than $N() in $ixIn(). This is probably What You Want.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_or processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_and

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated logical "and" over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, $missing() is logically (and)ed into each result value at each output index with a run length of less than $N() in $ixIn(). This is probably What You Want.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_and processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_bor

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated bitwise "or" over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, $missing() is bitwise (or)ed into each result value at each output index with a run length of less than $N() in $ixIn(). This is probably What You Want.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_bor processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_band

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated bitwise "and" over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, $missing() is bitwise (and)ed into each result value at each output index with a run length of less than $N() in $ixIn(). This is probably What You Want.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_band processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_maximum

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated maximum over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, and if $missing() is greater than any listed value for a vector key with a run-length of less than $N(), then $missing() is used as the output value for that key. This is probably What You Want.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_maximum processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_minimum

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
     [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated minimum over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, and if $missing() is less than any listed value for a vector key with a run-length of less than $N(), then $missing() is used as the output value for that key. This is probably What You Want.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_minimum processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_maximum_nz_ind

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  indx [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated maximum_nz_ind over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

Output indices index $nzvalsIn, -1 indicates that the missing value is maximal.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_maximum_nz_ind processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_minimum_nz_ind

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  indx [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated minimum_nz_ind over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

Output indices index $nzvalsIn, -1 indicates that the missing value is minimal.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_minimum_nz_ind processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_nbad

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  int+ [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated number of bad values over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

Should handle missing values appropriately.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_nbad processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_ngood

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  indx [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated number of good values over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

Should handle missing values appropriately.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_ngood processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_nnz

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  indx [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated number of non-zero values over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

Should handle missing values appropriately.

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_nnz processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

ccs_accum_average

Signature: (
  indx ixIn(Ndims,NnzIn);
  nzvalsIn(NnzIn);
  missing();
  indx N();
  indx [o]ixOut(Ndims,NnzOut);
  float+ [o]nzvalsOut(NnzOut);
  indx [o]nOut();
  )

Accumulated average over values $nzvalsIn() associated with vector-valued keys $ixIn(). On return, $ixOut() holds the unique non-"missing" values of $ixIn(), $nzvalsOut() holds the associated values, and $nOut() stores the number of unique non-missing values computed.

If $N() is specified and greater than zero, then the quantity:

$missing * ($N - (rlevec($ixIn))[0]) / $N

is added to $nzvalsOut: this is probably What You Want if you are averaging over a virtual dimension in a sparse index-encoded PDL (see PDL::CCS::Nd for a wrapper class).

Returned PDLs are implicitly sliced such that NnzOut==$nOut().

In scalar context, returns only $nzvalsOut().

ccs_accum_average processes bad values. The state of the bad-value flag of the output ndarrays is unknown.

TODO / NOT YET IMPLEMENTED

extrema indices

maximum_ind, minimum_ind: not quite compatible...

statistical aggregates

daverage, medover, oddmedover, pctover, ...

cumulative functions

cumusumover, cumuprodover, ...

other stuff

zcover, intover, minmaximum

ACKNOWLEDGEMENTS

Perl by Larry Wall.

PDL by Karl Glazebrook, Tuomas J. Lukka, Christian Soeller, and others.

KNOWN BUGS

Probably many.

AUTHOR

Bryan Jurish <moocow@cpan.org>

Copyright (C) 2007-2024, Bryan Jurish. All rights reserved.

This package is free software, and entirely without warranty. You may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1), PDL(3perl)