The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

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

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

FUNCTIONS

ccs_accum_prod

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_dprod

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    double [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_sum

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_dsum

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    double [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_or

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_and

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_bor

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_band

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_maximum

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_minimum

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
       [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_maximum_nz_ind

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    int [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_minimum_nz_ind

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    int [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_nbad

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    int+ [o]nzvalsOut(NnzOut);
    int [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 does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_ngood

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    int+ [o]nzvalsOut(NnzOut);
    int [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 does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_nnz

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    int+ [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

ccs_accum_average

  Signature: (
    int ixIn(Ndims,NnzIn);
    nzvalsIn(NnzIn);
    missing();
    int N();
    int [o]ixOut(Ndims,NnzOut);
    float+ [o]nzvalsOut(NnzOut);
    int [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 does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles.

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-2013, 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)