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

lsqr! not minimizing norm #327

Open
FHell opened this issue Sep 5, 2022 · 1 comment
Open

lsqr! not minimizing norm #327

FHell opened this issue Sep 5, 2022 · 1 comment

Comments

@FHell
Copy link

FHell commented Sep 5, 2022

According to the documentation lsqr! should return the minimum norm solution if the matrix is ambiguous. This doesn't seem to work:

using IterativeSolvers

#-

A = zeros(5,5)
b = ones(5)
x = ones(5)

#-

lsqr!(x, A, b; damp = 1.)

#-

isapprox(x, ones(5)) # true

lsqr is working as expected:

y = lsqr(A, b; damp = 1.)

isapprox(y, zeros(5)) # true

Julia 1.8, IterativeSolvers v0.9.2

@FHell
Copy link
Author

FHell commented Sep 5, 2022

Incidentally: lsmr! and lsmr show the same behavior.

Edit:

And a nontrivial example:

x = ones(4)
b = ones(4)

v1 = rand(4)
v2 = rand(4)
v3 = rand(4)

w1 = rand(4)
w2 = rand(4)
w3 = rand(4)

A = v1 * transpose(w1) + v2 * transpose(w2) + v3 * transpose(w3)

#-

lsqr!(x, A, b)
y = lsqr(A, b)

#-

isapprox(x, y) # false

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

1 participant