help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Efficient submatrix computation or matrix index looping


From: fuankarion
Subject: Efficient submatrix computation or matrix index looping
Date: Fri, 20 May 2011 14:37:20 -0700 (PDT)

Hi,

I need to get all the submatrices of size NXN of a matrix of size MXM (M>N),
is there an efficient way of doing this?
Right now I'm iterating through all the elements in the MXM matrix with a
nested loop, something like:

for indexX =1:size(MATRIX)(1)
   for indexY = 1:size(MATRIX)(2)
... (get submatrix of size NXN  centered at indexX,indexY here)
   end
end

Code above DOES work, I get the matrices I need, but it is extremely slow,
is there another (faster) way to iterate through all the elements of the
matrix, so that I can build faster the submatrices around it? or is there a
function to get this submatrices automatically?

If no optimization of the code above is possible, could you point me to a
good tutorial/example so that I can parallelize the execution of the
instructions inside for loop, I've notice the code above keep a a single
core near 100% load and the others nearly idle

Thanks
Fuanka

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Efficient-submatrix-computation-or-matrix-index-looping-tp3539662p3539662.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]