I wrote the following code and an error occurred in the function part.
I think that the number of elements of the array is correct, but I do not know why the error occurs.
function jacobi(x::Matrix{Float64},A::Matrix{Float64},b::Matrix{Float64})
n=size(x,1)
x_new=copy(x)
sum=zeros(n)
b_sum=0
for i in 1:n
b_sum+=(abs(b[i]^2))^0.5
end
count=0
if count==0
for i in 1:n
for j in 1:n
if i!=j
sum[i]+=A[i,j]*x[j]
end
end
x_new[i]=(b[i]-sum[i])/A[i,i]
end
nrm=zeros(n)
nrm=x_new-x
nrm_sum=0
for i in 1:n
nrm_sum+=(abs(nrm[i])^2)^0.5
end
if nrm_sum<5e-1
count=1
end
end
end
A=[3 1 1; 1 3 1; 1 1 3]
b=[0,4,6]
x=zeros(3)
jacobi(x,A,b)
So, please tell me what is wrong.
ERROR: LoadError: MethodError: no method matching jacobi(::Array{Float64,1}, ::Array{Int64,2}, ::Array{Int64,1})Stacktrace:
[1] top-level scope at none:0