[EMAIL PROTECTED] wrote: > >I'm trying to write a program that will find the distance between two >groups of points in space, which have cartesian co-ordinates X,Y and >Z. > >I need to find the distances between each point in one group and every >point in the other group. So if group 1 has 6 points and group 2 had 8 >points, I will calculate 6 x 8 = 48 distances. But I do not know the >number of points the user will want to use. It is typically between 50 >and 500 in both groups combined, but may be more. Since the memory >required for the distances will be much larger than the points >themselves, I am wondering if I will have to allocate memory >dynamically or if there are easier ways of solving such problems in >Python.
Python already allocates memory dynamically. With 500 in each group, you'll have 250,000 distances. If you use floating point, that's only 2 megabytes. Piece of cake. With 1,000 in each group, it's 8 megabytes. Still no sweat. What are you going to do with these distances? Why do you need them all in memory? -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list