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
5-arg mul gives wrong result #33214
Comments
@tkf this occurs on Julia 1.4 master, for a variety of matrix types. Any idea why? |
Thanks for the heads up. It turned out to be a stupid mistake (alpha and beta swapped). #33218 should fix it. |
I only just hit another problem where alpha and beta were both floats and the output was incorrect- makes sense that it's not an issue with integers :-). In case it's useful to test, using Random, SparseArrays, LinearAlgebra
Random.seed!(1)
n = 100;
A = Symmetric(rand(n, n))
B = sparse(rand(n, n))
C = zeros(n, n)
mul!(C, B, A, -1.0, 0.0)
D = -B * A
@show norm(D - C) # 2543.524362254463 The error is not triggered without the |
I forgot to address this part. @lkapelevich Can you give me an example? Is the snippet you just posted the same as what you mentioned in the OP? |
#33214 (comment) dispatches to the same method I fixed in #33218 |
What I meant in the description was that I was also getting incorrect results when Random.seed!(1)
n = 100
A = sparse(rand(n, n))
B = sparse(rand(n, n))
C = spzeros(n, n)
mul!(C, B, A, -1, 0)
D = -B * A
@show norm(D - C) # 2534.227986442133 |
(I didn't notice that alpha and beta need not be integers) |
Thanks. Fortunately, the new snippet (#33214 (comment)) is also handled by #33218, too (which is a bit surprising; I guess dispatch plumbing can be improved a lot...). |
Why did this hit julia> @btime mul!($C, $B, $A, -1, 0);
835.482 μs (69 allocations: 3.56 KiB)
julia> @btime mul!($C, $B, $A, -1.0, 0.0);
52.149 μs (0 allocations: 0 bytes) |
MWE:
This also happens for sparse arrays.
The text was updated successfully, but these errors were encountered: