Can anyone reproduce the following bug?
julia> A = randn(10,20) |> X -> X * X';
julia> x = rand(10);
julia> sA = Symmetric(A);
julia> all( A .== sA )
true
julia> (A * x)'
1×10 RowVector{Float64,Array{Float64,1}}:
11.538 7.90415 -1.03592 -3.84546 15.5033 3.37954 7.7948 4.26935 6.29426 5.57295
julia> (sA * x)'
1×10 RowVector{Float64,Array{Float64,1}}:
21.5629 15.7696 -4.14023 -10.6005 28.2271 5.50057 17.9761 6.60855 6.29426 5.57295
julia> Base.LinAlg.BLAS.symv('U', A, x)'
1×10 RowVector{Float64,Array{Float64,1}}:
21.5629 15.7696 -4.14023 -10.6005 28.2271 5.50057 17.9761 6.60855 6.29426 5.57295
I do on both v0.6.1 and v0.7.0. Both are linked to a local BLAS build. Additionally, symv
is slow:
julia> y = similar(x);
julia> @benchmark Base.LinAlg.BLAS.symv!('U', 1.0, $A, $x, 0.0, $y)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 1.014 μs (0.00% GC)
median time: 1.278 μs (0.00% GC)
mean time: 1.426 μs (0.00% GC)
maximum time: 187.736 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 10
julia> @benchmark A_mul_B!($y, $A, $x)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 75.414 ns (0.00% GC)
median time: 75.662 ns (0.00% GC)
mean time: 77.367 ns (0.00% GC)
maximum time: 144.184 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 971
On a laptop, with the JuliaPro v0.6.0.1 MKL version (Julia v0.6), I cannot reproduce the bug. Besides getting the correct answer, symv was also much faster – while A_mul_B
took 200 ns, symv took only 150 ns.
(EDIT: v0.7.0 on my laptop also gets the correct answer / can’t reproduce the bug.)
Perhaps this is a clue? Is it calling the wrong function somehow?
Also, the last two elements of the vector match.