Note that there are some explanatory texts on larger screens.

plurals
  1. POSpeed optimization involving a lot of matrices generated in C/C++ - storing in a file vs recomputing
    primarykey
    data
    text
    <p>This is the 'need to know details about the problem': As a part of an algorithm I am coding, it takes as an input a matrix of size 3000X400. For every row, I need to create a square matrix, ie of size 400x400. After I do this, I need to calculate a number R(i,j) where i,j are the square matrices(400x400) that have been generated for every row. </p> <p>Think of it as the computation of a correlation matrix if you will. instead of correlation I have my own algorithm that operates on square matrices generated. I have to compute R(i,j) for 0&lt;=i&lt;3000 and j=i+1 to 3000</p> <p>Here is my question: I dynamically allocate a 3D array which points to a square matrix ie my 3d array is (3000X400X400). I don't have enough memory to do this. For smaller sizes ie around (800*400*400) I have code that works perfectly. But clearly not enough memory to extend it to (3000*400) case. How do I do this? </p> <p>One(not-so-great)solution: Instead of computing every square matrix, what I do is, compute square matrix for i, and then when I loop around j = i+1 to 3000, I recompute the square matrices for each j and then calculate R(i,j). Clearly, I am recomputing a whole bunch of matrices, but atleast it is code that works. </p> <p>Are there are faster solutions that you guys can think of? I am competent enough that a qualitative solution will be enough. I was thinking about computing the square matrices and writing them to files and reading them as and when I need to compute R(i,j) - will this be faster than recomputing solution I gave? </p> <p>Thanks for the advice!!</p> <p>The solution using writing to a file and reading from it was way slower. Any nonhadoop ideas anyone? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload