moin Kenneth, your might be interested in the PDL::VectorValued module ( https://metacpan.org/pod/PDL::VectorValued), which actually includes a vesearchvec() which ought to do what you want O(log n), provided your vector-list is sorted.
marmosets, Bryan On Fri, Nov 14, 2014 at 2:20 AM, LYONS, KENNETH B (KENNETH) < [email protected]> wrote: > I need to be able to match a vector inside a PDL, and can’t find a way to > do it. The existence of qsortvec and uniqvec functions implies that such > a comparison function exists (since you’d need to do that to sort) but the > documentation doesn’t give any info on it. More specifically, if I have an > nxm PDL $P, containing vectors of length n in the first dimension, and an > nx1 PDL representing a test vector, $test, I want to be able to get the > indices along the 2nd dimension where the vector in the PDL matches the > test one. > > > > I would expect that such a function, which I’ll provisionally name > findveci, would operate as > > $findresult = $P->findveci($test) > > Where $findresult would be a 1-dimensional PDL giving the set of indices > along the second dimension of $P that match the vector $test. > > > > I should note that a similar purpose would be served by a function > uniqveci (which, although an obvious extension of the set that *are* > available, also seems not to exist), since you could combine that with > qsortvec to do what I’m talking about. At present, I’ve resorted to > pulling the vectors into perl lists and doing the matching there. But > that’s far slower, and it seems wrong to have to do it that way. > > > > Any suggestions? > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > > -- Bryan Jurish "There is *always* one more bug." [email protected] -Lubarsky's Law of Cybernetic Entomology
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
