I’m writing a program about image-processing. I need to store an int square matrix with the size of 480 000 columns and 480 000 rows. Any ideas how can I do that?
I’m writing a program about image-processing. I need to store an int square matrix
Share
Don’t use a 480,000 x 480,000 matrix.
The only reason to ever have this full matrix (assuming it is not sparse) is to have random access (i.e. be able to access any element at any time). Even if you can somehow achieve this (storing 0.9Tb), the data access will be extremely slow (in particular when mapping it to file), making your algorithm inefficient.
Instead, think of a way to re-write your algorithm such that it doesn’t need random access to the whole matrix at any time, but perhaps only to a small part of it, which you create (and then delete) when needed, or any other way of reducing the need to store this many data.
High performance is not just about a reduction of the amount of computing, but crucially also about the reduction in random data access.