It would probably help if we made the signature more
mnemonic as to what the values are being returned,
counts and values.  Since counts are always non-zero
for the valid elements,

  $counts->maximum_ind

gives you the number of elements in the rle() encoded
data.

--Chris


On Thu, Feb 20, 2014 at 12:57 PM, Chris Marshall <[email protected]> wrote:
> The current implementation seems to be the way that it is
> in order to support threading of rle() operations.  rld() also
> chooses an output size that is compatible with threaded
> computations.  Maybe the signature could be changed and
> the $a/$b outputs could be truncated to the minimum number
> of elements.  In the single vector case, that would give the
> desired result.
>
> --Chris
>
> On Tue, Feb 11, 2014 at 12:57 AM, Craig DeForest
> <[email protected]> wrote:
>> To be fair, rle could and should generate a truncated output PDL for 
>> itself...
>>
>>
>> On Feb 10, 2014, at 9:45 PM, Derek Lamb <[email protected]> wrote:
>>
>>> In your $idx below, you don't want the second occurrence of 0 in $b, you 
>>> want
>>> the first occurrence of 0 in $a.  Because if your data for some reason has 
>>> no 0
>>> in it, then your method fails.  All those zeroes in $rv are to be 
>>> expected--the $a
>>> and $b arrays have the same size as your input data, so you have to 
>>> truncate.
>>> Re-read the rle() docs.

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to