Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In place/aliasing bug? #30

Open
raminammour opened this issue Apr 8, 2020 · 1 comment
Open

In place/aliasing bug? #30

raminammour opened this issue Apr 8, 2020 · 1 comment

Comments

@raminammour
Copy link

raminammour commented Apr 8, 2020

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!

@Jutho
Copy link
Owner

Jutho commented Apr 8, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants