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

feat: support indexing Tuple parameters, add tests #63

Merged
merged 6 commits into from
Mar 28, 2024

Conversation

AayushSabharwal
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 0.00%. Comparing base (ed4bce0) to head (30b4759).

Files Patch % Lines
src/remake.jl 0.00% 10 Missing ⚠️
src/parameter_indexing.jl 0.00% 3 Missing ⚠️
src/trait.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master     #63   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           7       7           
  Lines         355     366   +11     
======================================
- Misses        355     366   +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SebastianM-C
Copy link
Contributor

When would one want to use Tuple indexing? Would that be used in conjunction with MTKParameters?

@AayushSabharwal
Copy link
Member Author

No, just allowing the parameter object to be a Tuple: ODEProblem(fn, u0, tspan, (1.0, 2.0, 3.0))

@AayushSabharwal AayushSabharwal force-pushed the as/tuple-parameter-values branch from 9f44ea1 to 30b4759 Compare March 28, 2024 06:36
else
mutbuffer = remake_buffer(sys, collect(oldbuffer), vals)
newbuffer = similar_type(oldbuffer, eltype(mutbuffer))(mutbuffer)
end
return newbuffer
end

mutable struct TupleRemakeWrapper
t::Tuple
Copy link
Member

Choose a reason for hiding this comment

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

This won't infer, Tuple isn't concrete

Copy link
Member Author

Choose a reason for hiding this comment

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

The type of the tuple can change, which is why it's not fully typed

Comment on lines +34 to +35
mutable struct TupleRemakeWrapper
t::Tuple
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mutable struct TupleRemakeWrapper
t::Tuple
mutable struct TupleRemakeWrapper{T <: Tuple}
t::T

?

@ChrisRackauckas ChrisRackauckas merged commit 124e387 into master Mar 28, 2024
9 of 10 checks passed
@ChrisRackauckas ChrisRackauckas deleted the as/tuple-parameter-values branch March 28, 2024 10:18
@ChrisRackauckas
Copy link
Member

Let's follow up with the performance bit if it's needed.

@AayushSabharwal
Copy link
Member Author

This can't really be fully inferred, since

  1. The dict in the last argument is not concrete
  2. The type of the buffer can change

@ChrisRackauckas
Copy link
Member

Gotcha

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.

3 participants