Handling a 450,000x450,000 array with Perl

F

francescomoi

Hi.

I'd like to create a program to handle data (natural numbers)
within a 450,000 x 450,000 array. I'm considering Perl, but
I don't know is it's powerful enough to manage it.

Thank you very much.
 
I

Ingo Menger

Hi.

I'd like to create a program to handle data (natural numbers)
within a 450,000 x 450,000 array. I'm considering Perl, but
I don't know is it's powerful enough to manage it.

Perl is, but you'll find few computers that could store 202 billion
"natural numbers".
Remember, a PC has a RAM of around 2 billion bytes, give or take a few.
You could hold a maximum of 16 billion natural numbers as long as they
are 0 or 1. But, 16 billion is still not 202 billion.

In any case, this will be a system where native integers have 64 bits.
 
F

francescomoi

Hi.

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.

Thank you very much.
 
T

Ted Zlatanov

On 30 Oct 2006, bugbear@trim_papermule.co.uk_trim wrote:

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
 
X

xhoster

Hi.

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.

So then, I assume the square meters' must be rotationally aligned parallel
to the axes of the millimeter scale. But can one square meter "slide" by
a millimeter in order to make another square meter, or does it have to
slide by a full meter? I.e. can the potential square meters overlap each
other?

Xho
 
A

anno4000

"The square meter" as in, divide the surface into meter-squares like
a checkerboard and find the one with the most elements? Or as in,
find the one-meter square that holds the most elements? The first
ones must start on integer meter-coordinates, the other can start
anywhere. The second search space is much larger.
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.

There is, however, a likely Perl answer: Use a hash. It is often
the most straight-forward way to represent a sparse anything.

Here one could use blank-separated integer coordinates (in mm) for
keys and the (nonzero) number of elements for values. Values of
zero are *not* entered. Some care may be needed not to autovivify
these non-entries.

Anno
 
P

Peter Scott

I'd like to create a program to handle data (natural numbers)
within a 450,000 x 450,000 array. I'm considering Perl, but
I don't know is it's powerful enough to manage it.

Any time you want to work with a matrix of lots of numbers in Perl,
consider http://pdl.perl.org/.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top