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

get_fsalfirstlast method error #2533

Open
ParamThakkar123 opened this issue Nov 16, 2024 · 8 comments
Open

get_fsalfirstlast method error #2533

ParamThakkar123 opened this issue Nov 16, 2024 · 8 comments
Labels

Comments

@ParamThakkar123
Copy link
Contributor

ParamThakkar123 commented Nov 16, 2024

solving the ODEProblem in SciMLBenchmarks for Henon_Heiles_energy_conservation_benchmarks using TaylorMethod() function gives the following method call error which didn't occur in the previous versions

MethodError: no method matching get_fsalfirstlast(::TaylorIntegrationDiffEqExt.TaylorMethodCache{Vector{Float64}, Vector{Float64}, Taylor1{Float64}, Vector{Taylor1{Float64}}}, ::Vector{Float64})



Closest candidates are:

  get_fsalfirstlast(!Matched::OrdinaryDiffEqQPRK.QPRK98Cache, ::Any)

   @ OrdinaryDiffEqQPRK C:\Users\Hp\.julia\packages\OrdinaryDiffEqQPRK\7AUMg\src\qprk_caches.jl:33

  get_fsalfirstlast(!Matched::OrdinaryDiffEqLowOrderRK.MSRK6Cache, ::Any)

   @ OrdinaryDiffEqLowOrderRK C:\Users\Hp\.julia\packages\OrdinaryDiffEqLowOrderRK\CPmMP\src\low_order_rk_perform_step.jl:1455

  get_fsalfirstlast(!Matched::OrdinaryDiffEqLowOrderRK.SIR54Cache, ::Any)

   @ OrdinaryDiffEqLowOrderRK C:\Users\Hp\.julia\packages\OrdinaryDiffEqLowOrderRK\CPmMP\src\low_order_rk_perform_step.jl:1696

  ...





Stacktrace:
...
   @ c:\Users\Hp\Desktop\SciMLBenchmarks.jl\benchmarks\DynamicalODE\jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_W3sZmlsZQ==.jl:4 [inlined]

 [6] top-level scope

   @ c:\Users\Hp\Desktop\SciMLBenchmarks.jl\benchmarks\DynamicalODE\jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_W5sZmlsZQ==.jl:1

Code to reproduce the issue :

https://github.com/SciML/SciMLBenchmarks.jl/blob/master/benchmarks/DynamicalODE/Henon-Heiles_energy_conservation_benchmark.jmd

on Julia version 1.10.4 and TaylorIntegration version 0.16.1, OrdinaryDiffEq version 6

@ChrisRackauckas
Copy link
Member

TaylorIntegration.jl needs a dispatch for the method.

@ParamThakkar123
Copy link
Contributor Author

ParamThakkar123 commented Nov 16, 2024

Should I raise an issue on the TaylorIntegration.jl repository for this ??

@ChrisRackauckas
Copy link
Member

yes or PR

@ParamThakkar123
Copy link
Contributor Author

raised an issue in TaylorIntegration.jl PerezHz/TaylorIntegration.jl#200

will start with a PR soon.

@ParamThakkar123
Copy link
Contributor Author

Should the dispatch method be implemented in OrdinaryDiffEq.jl or should it be in TaylorIntegration.jl. I implemented the dispatch methods in TaylorIntegration.jl code but they still error here :

 Expression: solve(prob, TaylorMethod(20), abstol = 1.0e-20)
  MethodError: no method matching get_fsalfirstlast(::TaylorIntegrationDiffEqExt.TaylorMethodCache{Vector{Float64}, Vector{Float64}, Taylor1{Float64}, Vector{Taylor1{Float64}}}, ::Vector{Float64})
  The function `get_fsalfirstlast` exists, but no method is defined for this combination of argument types.

  Closest candidates are:
    get_fsalfirstlast(::OrdinaryDiffEqIMEXMultistep.IMEXMutableCache, ::Any)
     @ OrdinaryDiffEqIMEXMultistep C:\Users\Hp\.julia\packages\OrdinaryDiffEqIMEXMultistep\2dPDm\src\imex_multistep_caches.jl:3
    get_fsalfirstlast(::OrdinaryDiffEqLowOrderRK.MidpointCache, ::Any)
     @ OrdinaryDiffEqLowOrderRK C:\Users\Hp\.julia\packages\OrdinaryDiffEqLowOrderRK\CPmMP\src\fixed_timestep_perform_step.jl:192
    get_fsalfirstlast(::OrdinaryDiffEqFunctionMap.FunctionMapCache, ::Any)
     @ OrdinaryDiffEqFunctionMap C:\Users\Hp\.julia\packages\OrdinaryDiffEqFunctionMap\15mZr\src\functionmap_caches.jl:6
    ...

  Stacktrace:
    [1] __init(prob::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, ODEFunction{true, SciMLBase.AutoSpecialize, var"#f!#382", LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, @Kwargs{}, SciMLBase.StandardODEProblem}, alg::TaylorIntegrationDiffEqExt.TaylorMethodParams, timeseries_init::Tuple{}, ts_init::Tuple{}, ks_init::Tuple{}, recompile::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Float64, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Rational{Int64}, abstol::Float64, reltol::Nothing, qmin::Rational{Int64}, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, beta1::Nothing, beta2::Nothing, qoldinit::Rational{Int64}, controller::Nothing, fullnormalize::Bool, failfactor::Int64, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), progress_id::Symbol, userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEqCore.DefaultInit, kwargs::@Kwargs{})
      @ OrdinaryDiffEqCore C:\Users\Hp\.julia\packages\OrdinaryDiffEqCore\NnA60\src\solve.jl:475
    [2] solve(::ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, ODEFunction{true, SciMLBase.AutoSpecialize, var"#f!#382", LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, @Kwargs{}, SciMLBase.StandardODEProblem}, ::TaylorIntegrationDiffEqExt.TaylorMethodParams; verbose::Bool, kwargs::@Kwargs{abstol::Float64})
      @ TaylorIntegrationDiffEqExt C:\Users\Hp\.julia\packages\TaylorIntegration\CrO67\ext\TaylorIntegrationDiffEqExt.jl:244
    [3] (::var"#344#390"{ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, ODEFunction{true, SciMLBase.AutoSpecialize, var"#f!#382", LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, @Kwargs{}, SciMLBase.StandardODEProblem}})()
      @ Main .\none:0
    [4] with_logstate(f::var"#344#390"{ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SciMLBase.NullParameters, ODEFunction{true, SciMLBase.AutoSpecialize, var"#f!#382", LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, @Kwargs{}, SciMLBase.StandardODEProblem}}, logstate::Base.CoreLogging.LogState)
      @ Base.CoreLogging .\logging\logging.jl:522
    [5] with_logger(f::Function, logger::TestLogger)
      @ Base.CoreLogging .\logging\logging.jl:632
    [6] #collect_test_logs#75
      @ C:\Users\Hp\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\logging.jl:126 [inlined]
    [7] collect_test_logs
      @ C:\Users\Hp\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\logging.jl:124 [inlined]
    [8] #match_logs#76
      @ C:\Users\Hp\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\logging.jl:274 [inlined]
    [9] macro expansion
      @ C:\Users\Hp\Desktop\TaylorIntegration.jl\test\common.jl:75 [inlined]
   [10] macro expansion
      @ C:\Users\Hp\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:1700 [inlined]
   [11] macro expansion
      @ C:\Users\Hp\Desktop\TaylorIntegration.jl\test\common.jl:73 [inlined]
   [12] macro expansion
      @ C:\Users\Hp\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:1700 [inlined]
   [13] top-level scope
      @ C:\Users\Hp\Desktop\TaylorIntegration.jl\test\common.jl:10

@ParamThakkar123
Copy link
Contributor Author

ParamThakkar123 commented Nov 21, 2024

Dispatch method I implemented :

function get_fsalfirstlast(cache::TaylorIntegrationDiffEqExt.TaylorMethodCache{Matrix{Float64}, Matrix{Float64}, Taylor1{Float64}, Matrix{Taylor1{Float64}}}, 
    u::Matrix{Float64})
    # Extract the FSAL components from the cache
    if isdefined(cache, :fsalfirst) && isdefined(cache, :k)
        return cache.fsalfirst, cache.k
    else
        # Fallback for cases where FSAL components might not be defined
        error("FSAL components not defined in the cache")
    end
end
function get_fsalfirstlast(cache::TaylorMethodCache{Vector{Float64}, Vector{Float64}, Taylor1{Float64}, Vector{Taylor1{Float64}}}, u::Vector{Float64})
    # Extract the FSAL components from the cache
    if isdefined(cache, :fsalfirst) && isdefined(cache, :k)
        return cache.fsalfirst, cache.k
    else
        # Fallback for cases where FSAL components might not be defined
        error("FSAL components not defined in the cache")
    end
end

@ChrisRackauckas
Copy link
Member

That's shadowing not extending. It should be OrdinaryDiffEqCore. get_fsalfirstlast and it has to be implemented in TaylorIntegrationDiffEqExt

@ParamThakkar123
Copy link
Contributor Author

ParamThakkar123 commented Nov 21, 2024

Yeah 👍 . Got it. Thank you !

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

No branches or pull requests

2 participants