In place/aliasing bug?
Hello,
First thanks for the package. There seems to be a bug in the following:
julia> linsolve(identity,rand(10))
([-3.411259393663508e-16, -1.705629696831754e-16, -2.1320371210396926e-16, -1.3325232006498079e-17, -2.1320371210396926e-16, -6.822518787327016e-16, -4.264074242079385e-16, -6.822518787327016e-16, -3.411259393663508e-16, -2.1320371210396925e-17], ConvergenceInfo: no converged values after 100 iterations and 102 applications of the linear map;
norms of residuals are given by (1.5362946534167095,).
)
julia> linsolve(x->copy(x),rand(10))
([0.45405764157553313, 0.9479983088580736, 0.6357434060853168, 0.9590624031355045, 0.37730901182712784, 0.09497638177435319, 0.5263104518163659, 0.19843955874258803, 0.7991780212359407, 0.6081845420845212], ConvergenceInfo: one converged value after 1 iterations and 3 applications of the linear map;
norms of residuals are given by (2.3055512673781017e-16,).
)
Given that the result is correct for the second form but not the first, I suspect an aliasing bug but I don't know the package well enough to track it down :)
I couldn't find any warnings against aliasing in the documentation either...
Cheers!
Yes the package assumes that the linear operator produces a new vector that neither shares memory with or overwrites the previous one. Maybe I should indeed mention this somewhere more explicitly. I kind of assumed that there would be few applications where you would be able to apply the linear operator in such a way that you share memory with the input.