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

Fix bcresid_prototype in TwoPointBVPFunction #522

Closed
wants to merge 1 commit into from

Conversation

ErikQQY
Copy link
Member

@ErikQQY ErikQQY commented Oct 8, 2023

When trying to construct a TwoPointBVPFunction without specifying bcresid_prototype, it throws errors

julia> f1 = SciMLBase.TwoPointBVPFunction(ex7_f!, (ex7_2pbc1!, ex7_2pbc2!))
ERROR: bcresid_prototype must be a tuple / indexable collection of length 2 for a inplace TwoPointBVPFunction
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] (BVPFunction{true, SciMLBase.FullSpecialize, true})(f::typeof(ex7_f!), bc::Tuple{typeof(ex7_2pbc1!), typeof(ex7_2pbc2!)}; mass_matrix::LinearAlgebra.UniformScaling{Bool}, analytic::Nothing, tgrad::Nothing, jac::Nothing, bcjac::Nothing, jvp::Nothing, vjp::Nothing, jac_prototype::Nothing, bcjac_prototype::Nothing, bcresid_prototype::Nothing, sparsity::Nothing, Wfact::Nothing, Wfact_t::Nothing, paramjac::Nothing, syms::Nothing, indepsym::Nothing, paramsyms::Nothing, observed::typeof(SciMLBase.DEFAULT_OBSERVED), colorvec::Nothing, bccolorvec::Nothing, sys::Nothing)
   @ SciMLBase ~/.julia/packages/SciMLBase/N8cDr/src/scimlfunctions.jl:4071
 [3] (BVPFunction{true, SciMLBase.FullSpecialize, true})(f::Function, bc::Tuple{typeof(ex7_2pbc1!), typeof(ex7_2pbc2!)})
   @ SciMLBase ~/.julia/packages/SciMLBase/N8cDr/src/scimlfunctions.jl:3966
 [4] BVPFunction(f::Function, bc::Tuple{typeof(ex7_2pbc1!), typeof(ex7_2pbc2!)}; twopoint::Val{true}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ SciMLBase ~/.julia/packages/SciMLBase/N8cDr/src/scimlfunctions.jl:4122
 [5] SciMLBase.TwoPointBVPFunction(::Function, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ SciMLBase ~/.julia/packages/SciMLBase/N8cDr/src/problems/bvp_problems.jl:154
 [6] SciMLBase.TwoPointBVPFunction(::Function, ::Vararg{Any})
   @ SciMLBase ~/.julia/packages/SciMLBase/N8cDr/src/problems/bvp_problems.jl:153
 [7] top-level scope
   @ REPL[10]:1

@codecov
Copy link

codecov bot commented Oct 8, 2023

Codecov Report

Merging #522 (bf167ce) into master (c6623b2) will increase coverage by 0.28%.
Report is 1 commits behind head on master.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #522      +/-   ##
==========================================
+ Coverage   40.41%   40.70%   +0.28%     
==========================================
  Files          53       53              
  Lines        3882     3882              
==========================================
+ Hits         1569     1580      +11     
+ Misses       2313     2302      -11     
Files Coverage Δ
src/scimlfunctions.jl 52.24% <100.00%> (+1.49%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -4067,8 +4067,8 @@ function BVPFunction{iip, specialize, twopoint}(f, bc;
end

if twopoint
if iip && (bcresid_prototype === nothing || length(bcresid_prototype) != 2)
error("bcresid_prototype must be a tuple / indexable collection of length 2 for a inplace TwoPointBVPFunction")
if iip && bcresid_prototype !== nothing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this different?

Copy link
Member Author

@ErikQQY ErikQQY Oct 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think when we are defining a TwoPointBVPFunction, bcresid_prototype can be defined as nothing right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it cannot, otherwise how would you know how many conditions are on the left vs right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, thanks

@ErikQQY ErikQQY closed this Oct 8, 2023
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 this pull request may close these issues.

2 participants