You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using DifferentiationInterface, SparseConnectivityTracer, SparseMatrixColorings
dense_first_order_backend =AutoForwardDiff()
sparse_first_order_backend =AutoSparse(
dense_first_order_backend;
sparsity_detector=SparseConnectivityTracer.TracerLocalSparsityDetector(),
coloring_algorithm=GreedyColoringAlgorithm(LargestFirst()),
)
functionf_sparse_vector(x::AbstractVector)
n =length(x)
ret = []
for i in1:n-1append!(ret, abs2(x[i +1]) -abs2(x[i]) +abs2(x[n - i]) -abs2(x[n - i +1]))
endreturn ret
end
xbig =rand(1000)
jac_prep_sparse_nonallocating =prepare_jacobian(f_sparse_vector, sparse_first_order_backend, zero(xbig))
ERROR: MethodError: no method matching jacobian_pattern_to_mat(::Vector{SparseConnectivityTracer.Dual{Float64, SparseConnectivityTracer.GradientTracer{…}}}, ::Vector{Any})
Closest candidates are:jacobian_pattern_to_mat(::AbstractArray{D}, ::AbstractArray{<:Real}) where {P, T<:SparseConnectivityTracer.GradientTracer, D<:SparseConnectivityTracer.Dual{P, T}}
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/4CmIb/src/trace_functions.jl:122
Stacktrace:
[1] _local_jacobian_sparsity(f::Function, x::Vector{Float64}, ::Type{SparseConnectivityTracer.GradientTracer{SparseConnectivityTracer.IndexSetGradientPattern{Int64, BitSet}}})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/4CmIb/src/trace_functions.jl:91
[2] jacobian_sparsity(f::Function, x::Vector{Float64}, ::TracerLocalSparsityDetector{SparseConnectivityTracer.GradientTracer{…}, SparseConnectivityTracer.HessianTracer{…}})
@ SparseConnectivityTracer ~/.julia/packages/SparseConnectivityTracer/4CmIb/src/adtypes_interface.jl:149
[3] _prepare_sparse_jacobian_aux(::DifferentiationInterface.PushforwardFast, ::Vector{…}, ::Tuple{…}, ::AutoSparse{…}, ::Vector{…})
@ DifferentiationInterfaceSparseMatrixColoringsExt ~/.julia/packages/DifferentiationInterface/gSdHF/ext/DifferentiationInterfaceSparseMatrixColoringsExt/jacobian.jl:61
[4] prepare_jacobian(::typeof(f_sparse_vector), ::AutoSparse{AutoForwardDiff{…}, TracerLocalSparsityDetector{…}, GreedyColoringAlgorithm{…}}, ::Vector{Float64})
@ DifferentiationInterfaceSparseMatrixColoringsExt ~/.julia/packages/DifferentiationInterface/gSdHF/ext/DifferentiationInterfaceSparseMatrixColoringsExt/jacobian.jl:41
[5] top-level scope
@ REPL[19]:1
Some type information was truncated. Use `show(err)` to see complete types.
The text was updated successfully, but these errors were encountered:
MWE from https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/tutorials/advanced/#Sparsity-speedup, not sure if this is intended or a bug
The text was updated successfully, but these errors were encountered: