Problem using ForwardDiff with backslash "\" matrix solver

You need to allocate A in such a way that it can hold elements of typeof(v), for example something like this

function f(v::AbstractVector{T}, xtrue) where T
    A = Matrix{T}(undef, 3, 3)
    # ...
end
2 Likes