
November 19th, 2003, 08:06 AM
|
 |
Contributing User
|
|
Join Date: Aug 2003
Location: UK
|
|
|
Why are you surprised? You are attempting to increase the storage requirement by a factor of 400! And what is this a matrix of (i.e. what data type)?
If this was a matrix on int type, a 20000 x 20000 array would require 1.5Gb of memory, wheras 999x999 only requires 3.8Mb. With virtual memory, you may just about manage it, (at least on NT/2K/XP, but maybe not Win 9x).
However, it will never work if you declare such an array as an automatic variable. You will have to declare it static, or use dynamic memory allocation. Having more than one such matrix is likely to be problematic. Processing such a large amount of data when most of it at any one time is swapped to disk will be very slow.
On the whole such a data structure is ill advised, since you are relying a great deal on the stability of the OS under such strain.
If your data type is larger than an int, the problem is worse.
I suggest you consider a more efficient algorithm or storage structure.
Clifford.
|