julia> A
2×2 Matrix{Float64}:
2.0 1.5
1.5 3.0
julia> x
2-element Vector{Float64}:
0.0
0.0
julia> y = similar(x)
2-element Vector{Float64}:
5.0e-324
0.0
julia> IterativeSolvers.cg!(y, A, x)
2-element Vector{Float64}:
NaN
NaN
It seems to happen when the allocated output vector contains garbage like above, but not if y = zeros(2) for example.
Edit: But maybe this is expected since x also doubles as the initial guess, not just a workspace vector. In particular, if x contains NaNs.
It seems to happen when the allocated output vector contains garbage like above, but not if
y = zeros(2)
for example. Edit: But maybe this is expected sincex
also doubles as the initial guess, not just a workspace vector. In particular, ifx
contains NaNs.