[SciPy-user] usings numpy arrays in sets

nicky van foreest vanforeest@gmail....
Thu Jun 25 16:18:37 CDT 2009


Hi,

>> The proper fix is to make a set() implementation that allows you to
>> provide your own hash and equality functions. This is a general
>> solution to a problem that affects more than just numpy arrays.

I do not quite see how to do this in a memory efficient way, which is
most surely due to my limited numpy knowledge, Nevertheless, with the
solution of Francesc I can control the size of elements I need to
store, and I can use these elements at the same time in the set
itself. Besides this, I prefer not to think about a good hash
function. For my case at hand using arrays rather than tuples allows
me to use a state space of 1e6 (or even slightly more) rather than 2e5
(or somewhat less) states. This extra space is critical to make the
referees of one my papers happy :-)

bye

Nicky


More information about the SciPy-user mailing list