help-octave
[Top][All Lists]
Advanced

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

implement a SOR like routine efficiently


From: Ganesh Bikshandi
Subject: implement a SOR like routine efficiently
Date: Mon, 15 Nov 2004 16:34:21 -0600

Hi,

I need to implement the following loop efficiently:

for i = 2:n-1
  for j = 2:n-1 
      a(i,j) = a(i-1,j) + a(i+1,j) + a(i,j+1) + a(i,j-1)
   end
end

The loop is not vectorizable, as it has a carried dependence. If I run
this loop as it is, it is very slow ( in my program n is  256 and
there are several iterations of the above two loops).  I am wondering
if there is a library function in MATLAB or a better way to do this
efficiently. Sorry, I know this is an octave user group, but I
couldn't get an answer in MATLAB user group.

Ganesh



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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