SparseDiffTools.jl icon indicating copy to clipboard operation
SparseDiffTools.jl copied to clipboard

out of place tag not being recorded properly

Open Veenty opened this issue 8 months ago • 1 comments

The out of place JacVec is not taking properly the tag parameter for out of place operations

using SparseDiffTools
using ForwardDiff
using LinearAlgebra

N = 10
A = rand(N,N)
function foo(x)
    println(typeof(x))
    return A*x
end

function foo!(y,x)
    println(typeof(x))
    mul!(y,A,x)
    return y 
end

J = JacVec(foo, rand(N), tag = nothing)
J! = JacVec(foo!, rand(N), tag = nothing)
J*rand(N);  #Vector{ForwardDiff.Dual{ForwardDiff.Tag{SparseDiffTools.DeivVecTag, Float64}, Float64, 1}}


y = similar(rand(N));
mul!(y, J, rand(N)); #Vector{ForwardDiff.Dual{Nothing, Float64, 1}}


Veenty avatar Apr 22 '25 19:04 Veenty