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

mul! returns invalid result for PDiagMat #122

Closed
oschulz opened this issue Dec 1, 2020 · 1 comment · Fixed by #124
Closed

mul! returns invalid result for PDiagMat #122

oschulz opened this issue Dec 1, 2020 · 1 comment · Fixed by #124

Comments

@oschulz
Copy link
Contributor

oschulz commented Dec 1, 2020

LinearAlgebra.mul! returns an invalid result for PDiagMat. Given

using LinearAlgebra, PDMats

A = PDiagMat([0.25, 0.75])
x = [0.0, 1.0]
y = similar(x)

We get

A * x == [0.0, 0.75]

as expected, but mul! gives

mul!(y, A, x) == [0.0, 0.0]

However,

mul!(y, Matrix(A), x) == [0.0, 0.75]

returns the correct result.

For some reason, LinearAlgebra.generic_matvecmul! doesn't seem to work correctly for PDiagMat.

Tested with Julia version v1.5.3 on Linux x86_64.

CC @vindex10, who noticed incorrect results caused by this in a actual use case.

@oschulz
Copy link
Contributor Author

oschulz commented Jan 5, 2021

Thanks!

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

Successfully merging a pull request may close this issue.

1 participant