Open MasonProtter opened 1 year ago
Do I infer correctly from the stack trace that this is actually a Julia Base (or actually LinearAlgebra
) bug, namely with rmul!(X::Vector{Complex}, s::Bool)
?
Yeah I find that quite strange. I couldn't reproduce the bug by just calling rmul!(::Vector{Complex}, ::Bool)
, so I think that what’s happening is that KrylovKit is generating undefined junk somewhere and then trying to rmul! that junk
Yeah, so if I make an undef
vector of Complex
then I get the error
julia> v = Vector{Complex}(undef, 2)
2-element Vector{Complex}:
#undef
#undef
julia> rmul!(v, false)
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
@ ./essentials.jl:13 [inlined]
[2] macro expansion
@ ~/julia/usr/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:183 [inlined]
[3] macro expansion
@ ./simdloop.jl:77 [inlined]
[4] rmul!(X::Vector{Complex}, s::Bool)
@ LinearAlgebra ~/julia/usr/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:182
[5] top-level scope
@ REPL[2]:1
So maybe the fix would just be to throw a more helpful error before actually hitting rmul!
?
The problem is that the implementation tries to be completely agnostic about the type of vector. So checking for undef
or abstract type parameters is not really possible, unless by adding a special branch for Vector
instances.
Someone on Slack ran into this issue when they accidentally ran
instead of using a concrete type.
Here's a MWE: