Hi,

I am using uniqind() but I need it to return the index of the *first*
unique value. As it is the function returns a seemingly random index:

pdl> $a=pdl(1,2,2,2)
pdl> p $a->uniqind
[0 1]
pdl> $b=pdl(1,2,2,2,2)
pdl> p $b->uniqind
[0 2]

Can anyone provide an efficient way of doing this?

I have come up with a convoluted method that does not scale well (when
the vector is large and has many non-unique values):

pdl> $tmp=$b->uniq->(*1)->minus($b,0) == 0
pdl> p $tmp->mult(xvals($tmp)+1,0)->setvaltobad(0)->minimum->minus(1,0)
[0 1]

My PDL version is old (v2.4.7), but it is installed on a server and they
would rather avoid upgrades...

Thanks for any help,
Trevor.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to