So now I'm using this function

A=[[2,1.]';[1,4]']
k2=Diagonal([3.,11.])^2
x=[[1,2]';[3.,4]']
farr=zeros(2,2)

n=length(x[:,1])
kd(i,j)=Int64(i .== j)

function f!(a,farr)
for i=1:n
for j=1:n
#for k=1:n
farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
#end
end
end
end

When I calculate f!(x,farr) I get the right result
Also when I define the function without the !

But when I just calculate f!(x) it works but it only calculates: x^2
I thought f! only calculates the result inplace so I do not have to specify 
farr, or what is the problem?

Reply via email to