From: Mathieu Bouchard Date: 2002-01-23T01:12:12+09:00 Subject: Re: swapping arrays On Wed, 23 Jan 2002, Philippe Monnier wrote: > I've tried to comput a half array of n*(n-1) of reals > or arrays of reals > @prox = Array.new > for i in 1..@bornesup-1 > @prox[i] = Array.new > for j in i+1..@bornesup > @prox[i][j] = .... > end > end > I improved big swap with n=510 and each @prox[i][j] containing an > array with 16 real values. I guess your matrix takes 55 megs of ram ? There are lots of tricks to save a little RAM here and there, but the biggest trick will be to download "narray". when you build your 16-element arrays, do NArray.double(16). This will take 3 times less RAM. (note: NArray is also multidimensional, so you could do NArray.double(510,510,16) once, but it won't make a big difference compared to the above change.) and don't forget to number indices starting from 0, or reserve an extra unused index. ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju