I need for some reason a four dimensional matrix in my python program which has a dimension like 10000x20000x4000x10. As I have tried to implement it using normal arrays in python I have found that it is impossible to do because of my restricted available system resources. What is the best way to manage such big data structures? Is the only way using Database?
Edit: Because it depends on what is my goal I will describe shortly what I am doing. I am trying to expand the 1 dimensional knapsack problem to 4 dimensions. There are 2 matrices keep and solution which have to be accessed. As I try to address the resource allocation problem of routers with this these 2 matrices look like this:
keep = [[[[0 for x in xrange(CORE.cap + 1)*1000]for x in xrange(RAM.cap + 1)*1000]for x in xrange(NIC.cap + 1)*1000]for x in xrange(len(JOBS) + 1)]
solution = [[[[0 for x in xrange(CORE.cap + 1)*1000]for x in xrange(RAM.cap + 1)*1000]for x in xrange(NIC.cap + 1)*1000]for x in xrange(len(JOBS) + 1)]
There are a lot of 0 in these matrices and I have to access each row of the matrices each time.