Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for round #152

Closed
SouthEndMusic opened this issue Aug 7, 2024 · 2 comments · Fixed by #162
Closed

Add support for round #152

SouthEndMusic opened this issue Aug 7, 2024 · 2 comments · Fixed by #162

Comments

@SouthEndMusic
Copy link
Contributor

SouthEndMusic commented Aug 7, 2024

I tried to make a MWE for this, but I came across a different problem:

using SparseConnectivityTracer: TracerLocalSparsityDetector, jacobian_sparsity
using DataInterpolations: LinearInterpolation
detector = TracerLocalSparsityDetector()
A = LinearInterpolation([0.0, 2.0], [0.0, 2.0])

function f!(output, input)
    output .= A.(input)
end

input = rand(5)
output = zero(input)

jacobian_sparsity(f!, output, input, detector)

This gives

MethodError: no method matching round(::Type{Int64}, ::SparseConnectivityTracer.Dual{Float64, SparseConnectivityTracer.GradientTracer{…}})

This is by the way because the searching method within ordered vector used by FindFirstFunctions depends on the way that vector is distributed.

@adrhill
Copy link
Owner

adrhill commented Aug 13, 2024

This is fixed in #162, however the next method error pops up in FindFirstFunctions.jl:

julia> jacobian_sparsity(f!, output, input, detector)
ERROR: MethodError: no method matching searchsortedlastcorrelated(::Vector{…}, ::SparseConnectivityTracer.Dual{…}, ::SparseConnectivityTracer.Dual{…})

Closest candidates are:
  searchsortedlastcorrelated(::T, ::Any, ::FindFirstFunctions.Guesser{T}) where T<:(AbstractVector)
   @ FindFirstFunctions ~/.julia/packages/FindFirstFunctions/2w5qZ/src/FindFirstFunctions.jl:284
  searchsortedlastcorrelated(::AbstractVector, ::Any, ::T) where T<:Integer
   @ FindFirstFunctions ~/.julia/packages/FindFirstFunctions/2w5qZ/src/FindFirstFunctions.jl:265
  searchsortedlastcorrelated(::AbstractRange, ::Any, ::Integer)
   @ FindFirstFunctions ~/.julia/packages/FindFirstFunctions/2w5qZ/src/FindFirstFunctions.jl:271

Stacktrace:
  [1] get_idx(A::LinearInterpolation{…}, t::SparseConnectivityTracer.Dual{…}, iguess::Int64; lb::Int64, ub_shift::Int64, idx_shift::Int64, side::Symbol)
    @ DataInterpolations ~/.julia/packages/DataInterpolations/i1xgb/src/interpolation_utils.jl:133

@adrhill
Copy link
Owner

adrhill commented Aug 13, 2024

We'll soon to write a guide on how to extend your own methods on tracers (see #163).
This should allow you to support searchsortedlastcorrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants