SciML / LineSearch.jl

Line Search Algorithms
MIT License
2 stars 2 forks source link

UndefVarError: `jvp_op` not defined in local scope #17

Open oscardssmith opened 3 days ago

oscardssmith commented 3 days ago

I ran into

  UndefVarError: `jvp_op` not defined in local scope
  Suggestion: check for an assignment to a local variable that shadows a global of the same name.
  Stacktrace:
    [1] (::LineSearch.var"#5#6")(du::Vector{Float64}, u::Vector{Float64}, fu::Vector{Float64}, p::Nothing)
      @ LineSearch ~/.julia/packages/LineSearch/Ky1ZB/src/utils.jl:42

with

Status `~/.julia/dev/DAECompiler/Manifest.toml`
  [87fe0de2] LineSearch v0.1.4

Any idea what caused this?

avik-pal commented 1 hour ago

Either I am blind or all branches in that function do define a jvp_op... Which algorithm triggered this?

oscardssmith commented 31 minutes ago

The relavent stack trace is attached. This is using RobustMultiNewton(autodiff=AutoFiniteDiff()) with a singular jacobian, and a jacobian I think

[4] solve!(cache::LineSearch.LineSearchesJLCache{NonlinearFunction{true, SciMLBase.FullSpecialize, 
OrdinaryDiffEqNonlinearSolve.var"#_initialize_dae!##"{ODEFunction{true, SciMLBase.FullSpecialize, Funtion, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Function, Function, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Function, Nothing, TransformedIRODESystem, Nothing, Nothing}, Type{ForwardDiff.Dual}, Bool, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Bool}, Float64, Vector{Bool}, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing}, Nothing, LineSearch.var"#64#65"{typeof(+), typeof(*), SciMLBase.NLStats}, LineSearch.var"#66#67"{typeof(+), typeof(*), SciMLBase.NLStats}, LineSearch.var"#68#69"{typeof(+), typeof(*), SciMLBase.NLStats}, LineSearches.BackTracking{Float64, Int64}, Float64, Float64, LineSearch.var"#5#6", Vector{Float64}, Vector{Float64}, SciMLBase.NLStats, LineSearch.LineSearchesJL{LineSearches.BackTracking{Float64, Int64}, Bool, Nothing}}, u::SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}, du::Vector{Float64})
  @ LineSearch ~/.julia/packages/LineSearch/Ky1ZB/src/line_searches_ext.jl:105
[5] __step!(cache::NonlinearSolve.GeneralizedFirstOrderAlgorithmCache{true, :LineSearch, false, Vector{Float64}, SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}, Vector{Float64}, Nothing, Vector{Float64}, Matrix{Float64}, 
    NonlinearSolve.GeneralizedFirstOrderAlgorithm{nothing, :NewtonRaphson, LineSearch.LineSearchesJL{LineSearches.BackTracking{Float64, Int64}, Bool, Nothing}, Missing, NonlinearSolve.NewtonDescent{Nothing, typeof(NonlinearSolve.DEFAULT_PRECS)},         ADTypes.AutoFiniteDiff{Val{:forward}, Val{:forward}, Val{:hcentral}}, ADTypes.AutoFiniteDiff{Val{:forward}, Val{:forward}, Val{:hcentral}}, Nothing}, NonlinearProblem{SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}, true, Nothing, NonlinearFunction{true, SciMLBase.FullSpecialize, OrdinaryDiffEqNonlinearSolve.var"#_initialize_dae!##30#_initialize_dae!##31"{ODEFunction{true, SciMLBase.FullSpecialize, Function, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Function, Function, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Function, Nothing, TransformedIRODESystem, Nothing, Nothing}, Type{ForwardDiff.Dual}, Bool, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Bool}, Float64, Vector{Bool}, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing}, @Kwargs{}, SciMLBase.StandardNonlinearProblem}, NonlinearSolve.JacobianCache{true, Matrix{Float64}, NonlinearFunction{true, SciMLBase.FullSpecialize, OrdinaryDiffEqNonlinearSolve.var"#_initialize_dae!##30#_initialize_dae!##31"{ODEFunction{true, SciMLBase.FullSpecialize, Function, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Functon, Function, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Function, Nothing, TransformedIRODESystem, Nothing, Nothing}, Type{ForwardDiff.Dual}, Bool, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Bool}, Float64, Vector{Bool}, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}, Nothing, ADTypes.AutoSparse{ADTypes.AutoFiniteDiff{Val{:forward}, Val{:forward}, Val{:hcentral}}, ADTypes.KnownJacobianSparsityDetector{Matrix{Float64}}, SparseMatrixColorings.GreedyColoringAlgorithm{:direct, SparseMatrixColorings.LargestFirst}}, DifferentiationInterfaceSparseMatrixColoringsExt.PushforwardSparseJacobianPrep{DifferentiationInterface.BatchSizeSettings{1, false, true}, SparseMatrixColorings.ColumnColoringResult{Matrix{Float64}, SparseMatrixColorings.BipartiteGraph{Int64}, Vector{SubArray{Int64, 1, Vector{Int64}, Tuple{UnitRange{Int64}}, true}}}, Matrix{Float64}, Vector{Tuple{Vector{Float64}}}, Vector{Tuple{Vector{Float64}}}, DifferentiationInterface.NoPushforwardPrep}}, NonlinearSolve.NewtonDescentCache{false, false, Vector{Float64}, Nothing, NonlinearSolve.LinearSolverCache{LinearSolve.LinearCache{Matrix{Float64}, Vector{Float64}, Vector{Float64}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, LinearAlgebra.QRCompactWY{Float64, Matrix{Float64}, Matrix{Float64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, Tuple{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, Vector{Int64}}, Nothing, Nothing, Nothing, LinearAlgebra.SVD{Float64, Float64, Matrix{Float64}, Vector{Float64}}, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}, Tuple{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int32}}, Base.RefValue{Int32}}, Tuple{LinearAlgebra.LU{Float64, Matrix{Float64}, Vector{Int64}}, Base.RefValue{Int64}}, LinearAlgebra.QRPivoted{Float64, Matrix{Float64}, Vector{Float64}, Vector{Int64}}, Nothing, Nothing}, IdentityOperator, IdentityOperator, Float64, Bool, LinearSolve.LinearSolveAdjoint{Missing}}, Nothing, Nothing, Nothing, typeof(NonlinearSolve.DEFAULT_PRECS)}, Nothing, Nothing, Nothing}, LineSearch.LineSearchesJLCache{NonlinearFunction{true, SciMLBase.FullSpecialize, OrdinaryDiffEqNonlinearSolve.var"#_initialize_dae!##30#_initialize_dae!##31"{ODEFunction{true, SciMLBase.FullSpecialize, Function, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Function, Function, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Function, Nothing, TransformedIRODESystem, Nothing, Nothing}, Type{ForwardDiff.Dual}, Bool, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Bool}, Float64, Vector{Bool}, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing}, Nothing, LineSearch.var"#64#65"{typeof(+), typeof(*), SciMLBase.NLStats}, LineSearch.var"#66#67"{typeof(+), typeof(*), SciMLBase.NLStats}, LineSearch.var"#68#69"{typeof(+), typeof(*), SciMLBase.NLStats}, LineSearches.BackTracking{Float64, Int64}, Float64, Float64, LineSearch.var"#5#6", Vector{Float64}, Vector{Float64}, SciMLBase.NLStats, LineSearch.LineSearchesJL{LineSearches.BackTracking{Float64, Int64}, Bool, Nothing}}, Nothing, Nothing, Nothing, DiffEqBase.NonlinearTerminationModeCache{false, AbsSafeBestTerminationMode{:Inf, Int64, Base.Fix1{typeof(maximum), typeof(abs)}, Nothing, Int64, Float64}, SciMLBase.ReturnCode.T, Vector{Float64}, Float64, Float64, Float64, Float64, Vector{Float64}, Nothing, Nothing, Vector{Float64}, Int64, Vector{Float64}}, NonlinearSolve.NonlinearSolveTrace{false, false, NonlinearSolve.TraceMinimal, Nothing, NonlinearProblem{SubArray{Float64, 1, Vector{Float64}, Tuple{Vector{Int64}}, false}, true, Nothing, NonlinearFunction{true, SciMLBase.FullSpecialize, OrdinaryDiffEqNonlinearSolve.var"#_initialize_dae!##30#_initialize_dae!##31"{ODEFunction{true, SciMLBase.FullSpecialize, Function, SparseArrays.SparseMatrixCSC{Float64, Int64}, Nothing, Function, Function, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, Nothing, Function, Nothing, TransformedIRODESystem, Nothing, Nothing}, Type{ForwardDiff.Dual}, Bool, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, PreallocationTools.DiffCache{Vector{Float64}, Vector{Float64}}, Vector{Float64}, Vector{Bool}, Float64, Vector{Bool}, Nothing}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Matrix{Float64}, Matrix{Float64}, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing}, @Kwargs{}, SciMLBase.StandardNonlinearProblem}}, @Kwargs{verbose::Bool}}; recompute_jacobian::Nothing, kwargs::@Kwargs{})
  @ NonlinearSolve ~/.julia/packages/NonlinearSolve/sBl1H/src/core/generalized_first_order.jl:276