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: some fixes related to usage of array symbolics #3126

Merged
merged 8 commits into from
Oct 24, 2024

Conversation

AayushSabharwal
Copy link
Member

Requires JuliaSymbolics/Symbolics.jl#1307

Regarding the improvement of the "hack", the issue with the old implementation was that it put OffsetArrays inside equations, which we can't codegen (SymbolicUtils.Code.create_array(::Type{<:OffsetArray}, ...) doesn't exist). This fixes that so we generate code equivalent to y = OffsetArrays.Origin(0)([1, 2, 3]).

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.

@AayushSabharwal
Copy link
Member Author

Requires JuliaSymbolics/Symbolics.jl#1309

@AayushSabharwal
Copy link
Member Author

This should be good to go now

@ChrisRackauckas
Copy link
Member

It looks like this causes a lot of issues to MethodOfLines?

@AayushSabharwal
Copy link
Member Author

Yeah, it seems the CSE hack is invalid in some cases. I'll work on fixing it.

@AayushSabharwal AayushSabharwal force-pushed the as/symarray-fixes branch 3 times, most recently from 2d72d68 to ed9ec6d Compare October 22, 2024 12:27
@AayushSabharwal AayushSabharwal marked this pull request as draft October 23, 2024 13:21
@AayushSabharwal AayushSabharwal marked this pull request as ready for review October 23, 2024 14:52
# ideally, we want to support equations such as `p ~ [p[1], p[2]]` which will then be handled
# by the topological sorting and dependency identification pieces
obs_arr_subs = Dict()
unknowns = Any[v
Copy link
Member

Choose a reason for hiding this comment

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

It might be good to refactor this into a function call that is able to be turned on/off.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I'll pull it out into a function and propagate a keyword argument to toggle it. Should it be on by default or off? I feel like HACK2 should be on by default, and CSE off since that's the more bug-prone of the two

Copy link
Member

Choose a reason for hiding this comment

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

The CSE one seems pretty essential to a lot of applications? I would try to see if we can get them on by default. But yes making an option would then make it much easier to isolate any potential bugs to it.

@AayushSabharwal AayushSabharwal marked this pull request as draft October 24, 2024 17:04
@AayushSabharwal
Copy link
Member Author

There's a bug

@AayushSabharwal AayushSabharwal marked this pull request as ready for review October 24, 2024 17:30
@ChrisRackauckas ChrisRackauckas merged commit c8ac522 into SciML:master Oct 24, 2024
36 of 39 checks passed
@AayushSabharwal AayushSabharwal deleted the as/symarray-fixes branch October 25, 2024 05:52
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