There are no known bugs with either. If you have a test case showing a failure, please report it.
Note: The comparisons are strictly numeric so if you need some sort of approximate equality threshold for floating point, you would need to do the conversion yourself. --Chris On Wed, Sep 19, 2012 at 5:13 PM, dpath2o <[email protected]> wrote: > Bryan, Chris, > > Thank you both for your responses. Possibly, I should have simply asked, > how well tested is 'uniq' and its kin? Or are there any limitations to these > functions that the documentation may have forgot to mention? > > 'uniq' or 'uniqvec' do not appear to work for me. The original example I > gave is a bit trivial because I had used integers. My 'real world' > application is using double floating point precision. > > When I pass uniqvec an Nx2 matrix, where column 1 is comprised of numbers of > that range from -180 to 180, column 2 is comprised of numbers that are from > -90 to 90, (i.e. longitudes and latitudes) and both have a precision on the > order of 10^-7. 'uniqvec' returns all the values of the original matrix, > when in fact I know that in fact there are repeated pairs. My work around > for this is to loop through each pair and use a distance function to find > those points that are within a certain tolerance of the point being > searched. This works but is heavy handed. > > Cheers, > Dan > > > > On 19 September 2012 22:46, Chris Marshall <[email protected]> wrote: >> >> You should be able to search using the pdldoc >> command or the help or apropos commands in >> the PDL shells: >> >> pdl> apropos unique >> uniq return all unique elements of a piddle >> uniqind Return the indices of all unique elements of a piddle >> The order is in the order of the values to be consistent >> with uniq. `NaN' values never compare equal with any >> other value and so are always unique. This follows the >> Matlab usage. >> uniqvec Return all unique vectors out of a collection >> >> >> >> On Tue, Sep 18, 2012 at 11:33 PM, dpath2o <[email protected]> wrote: >> > Hi, >> > >> > I'm wondering if anyone may have insight on determining the indices of >> > unique pairs, triplets, quadruplets, etc. >> > >> > Consider: >> > $x = pdl[1,5,8,9,12,20,18,16,16,13, 2,1,5,7,13,15] >> > $y = pdl[0,2,1,7, 2, 6, 9, 4, 9,20,20,0,8,7,20, 5] >> > $o = pdl[$x,$y] >> > $i = $o->uniqind >> > >> > My desire is to have $i = [0 1 2 3 4 5 6 7 8 9 10 12 13 15]; noting that >> > 11 >> > and 14 are absent because they're repeats. >> > The obvious solution is to sum and then determine unique sums (i.e. $s = >> > $x+$y; $i = $s->uniqind), but this seems a little careless, and does not >> > work on ND matrices. Further it does not allow for further diagnostics, >> > like the frequency or number of occurrences of pairs, triplets, etc. >> > >> > Does anyone have a more robust solution or is there interest in >> > enhancing >> > the functionality of 'uniq' (and its kin) to obtain results on, at the >> > very >> > least, 2D and possibly ND matrices? >> > >> > Cheers, >> > Dan >> > >> > _______________________________________________ >> > Perldl mailing list >> > [email protected] >> > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> > > > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
