help-octave
[Top][All Lists]
Advanced

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

Re: Successive Over-Relaxation ... what is wrong? Improvements?


From: marco atzeri
Subject: Re: Successive Over-Relaxation ... what is wrong? Improvements?
Date: Tue, 06 Nov 2012 17:36:33 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

On 11/6/2012 4:54 PM, Joza wrote:
Thanks for the info...stuff to think about! Besides all this, is there any
neat ways to speed out plain old FOR loops using vectors? For example, the
ones I have below:

for i=1:n
                sum = 0.0;
                
                if i==1
                        for j=1:2
                                sum = sum + A(i,j)*x(j);
                        end
                elseif i==n
                        for j=n-1:n
                                sum = sum + A(i,j)*x(j);
                        end
                else
                        for j=i-1:i+1
                                sum = sum + A(i,j)*x(j);
                        end
                end


what about multiplication of sparse matrix and vector ?

assuming A sparse (n*n) with just 2 or 3 not-zero elements per
row and x vector (n*1)

my_sum=sum(A*x)

Regards
Marco


reply via email to

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