Re: How to speed up this calculation?
- To: mathgroup at smc.vnet.net
- Subject: [mg37254] Re: How to speed up this calculation?
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Fri, 18 Oct 2002 05:18:06 -0400 (EDT)
- Organization: University of Washington
- References: <aokc15$agm$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Cheng, If you have h and w on the order of 1000, then your points list will have 10^6 points in it. If you then want to have a list of every possible pair of points, that list will consist of 10^12 pairs. Each pair of points consists of 4 integers, so that means your pairs list will have 4 10^12 integers in it. Even if Mathematica could store each integer using 4 bytes, that would require over 10^13 bytes, or 10000 gigabytes of storage. In order for Mathematica to function efficiently, the above storage must be in memory and not in virtual memory on the hard drive. In other words, creating such a pairs list is impossible at the present time, and is probably impossible for the forseeable future. If you truly need such a pairs list, then you may be able to work with h and w on the order of 100 if you have a large amount of memory. What in the world are you trying to do? I doubt that creating such a pairs list is necessary for you to accomplish whatever it is you are trying to do. Carl Woll Physics Dept U of Washington "Cheng Liu" <cliu at lanl.gov> wrote in message news:aokc15$agm$1 at smc.vnet.net... > Dear group, > > I have the following question regarding a lengthy calculation > using Mathematica: > > For given w points in x direction and h points in y direction, I can > construct all the points using > > h=10; w=8; > points=Flatten[Transpose[Outer[List,Range[w],Range[h]]],1] > > Next, I need to find all the possible pairs of point including points > themselves, i.e., pair AA. I can use > > pairs=Outer[List,points,points,1] > > Then, I have to clear those pairs that repeat themselves, i.e., pair AB and > pair BA. Also, when w and h are of the order of 1000s, the computation > takes a very long time. Is there a better way of doing the second part of > the computation? Thanks in advance. > > Sincerely > > Cheng > > > ==================================================== > Cheng Liu, Ph.D. > MST-8, Structure/Property Relations > Materials Science and Technology Division > Los Alamos National Laboratory > Los Alamos, New Mexico 87545 > > Phone: 505-665-6892 (office), 505-667-9950 (lab) > Fax: 505-667-8021 > email: cliu at lanl.gov > ==================================================== > >