memory - How to implement a huge matrix in C -


i'm writing program numerical simulation in c. part of simulation spatially fixed nodes have float value each other node. directed graph. however, if 2 nodes far away, (farther cut-off length a) value 0.

to represent these "correlations" or float values, tried use 2d array, since have 100.000 , more nodes, correspond 40gb memory or so.

now, trying think of different solustions problem. don't want save these values on harddisk. don't want calculate them on fly. 1 idea sort of sparse matrix, 1 one can use in matlab.

do have other ideas, how store these values?

i new c, please don't expect experience.

thanks , best regards, jan oliver

how many nodes, on average, within cutoff distance given node determines memory requirement , tells whether need page disk. solution taking least memory hash table maps pair of nodes distance. since distance same each way, need enter hash table once pair -- put 2 node numbers in numerical order , combine them form hash key. use posix hsearch/hcreate/hdestroy functions hash table, although less ideal.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -