[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Implementing a Jacobi iterative method for Ax=b
From: |
Joza |
Subject: |
Re: Implementing a Jacobi iterative method for Ax=b |
Date: |
Sun, 28 Oct 2012 14:48:53 -0700 (PDT) |
Here is my latest code:
function [x, k] = Jacobi2(A, b, tol)
k = 0;
n = size(A,1);
x_old = zeros(n,1);
converged = 0;
for i=1:n
if A(i,i) == 0.0
W = A(dmperm(A), :)
break
else W = A;
end
end
for i=1:n
D_inv(i,i) = 1/W(i,i)
end
while ~converged
x_new = x_old + D_inv*(b - W*x_old) % Correction form
k = k + 1;
if norm(b - W*x_new)/norm(b) < tol
x = x_new
converged = 1;
else
x_old = x_new;
end
end
************************************************
I reorder the matrix using dmperm so that no diagonals are zero.
When i run this get the error:
warning: broken pipe -- some output may be lost
Whats going on!!??
--
View this message in context:
http://octave.1599824.n4.nabble.com/Implementing-a-Jacobi-iterative-method-for-Ax-b-tp4645833p4645849.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Implementing a Jacobi iterative method for Ax=b, Joza, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Joza, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Juan Pablo Carbajal, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Joza, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b,
Joza <=
- Re: Implementing a Jacobi iterative method for Ax=b, Sergei Steshenko, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Ozzy Lash, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, c., 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Ozzy Lash, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Joza, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Ozzy Lash, 2012/10/28
- Re: Implementing a Jacobi iterative method for Ax=b, Joza, 2012/10/29
- Re: Implementing a Jacobi iterative method for Ax=b, Joza, 2012/10/29
- Re: Implementing a Jacobi iterative method for Ax=b, Juan Pablo Carbajal, 2012/10/30
- Re: Implementing a Jacobi iterative method for Ax=b, Ozzy Lash, 2012/10/30