I need to do parallel processing of sub-matrices recursively (original matrix divided into 4 passed into a method). The matrix is stored as a 2D array. I can’t copy the elements each time to a new matrix as it turns out to be very expensive. Is there someway to reference the sub-matrices in java?
Perhaps, the question was not clear, I didn’t get an answer here.
I would write a wrapper around the
int[][]data and call it a Matrix class. Then write a methodgetSubMatrix(x, y, rows, cols). This is a simple Matrix class:This test program…:
…prints: