Re: Handling a 450,000x450,000 array with Perl



On 30 Oct 2006, bugbear@xxxxxxxxxxxxxxxxxxxxxxxxx wrote:

francescomoi@xxxxxxx wrote:
Thank you very much for your quick answers. I try to handle data from a
450x450 meter surface.

I've got 100,000 elements distributed on this surface, and each
square millimeter can hold one or more elements. So the array to create
is a sparse one: most of square millimeters holds zero elements, and
the rest, 20 or less.

I'm trying to find the square meter with more elements inside.

Ah. OK.

Your question should really be "what data structure should
I use to..."

It's not really a perl question at all, it's
really an algorithm and data structure question.

Well no, some languages have sparse arrays and some don't. So this is
definitely a language-specific question, the data structure is pretty
obvious.

For Perl 5, you want either a relevant CPAN module or just use hashes
that combine x and y uniquely. See
http://search.cpan.org/search?query=sparse&mode=all for some ideas.

Ted
.



Relevant Pages