in reply to Re^3: Hash-type lookup in PDL
in thread Hash-type lookup in PDL

Many thanks zentara and lin0,

Well, I went ahead and did it with my original approach of: convert the pdl to a perl list, then use a perl hash to look it up, then convert it back again. The batch job finished about half a day later, so it's an academic issue now really.

Still, (as a note for for posterity) there seem really to be two options being discussed here:

Either:

- a PDL lookup table, using which() or dice() to look up one value at a time (slow on big datasets),

or

- convert all the values in advance, as per zentara's code above...

Neither's ideal really... could be that converting to a perl scalar and using a hash is actually the best thing.

Thanks for your help, and best wishes,
andye