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: fix fast_substitute folding array of symbolics #1398

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AayushSabharwal
Copy link
Contributor

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

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

Project coverage is 6.44%. Comparing base (6202fa4) to head (4cdb222).
Report is 40 commits behind head on master.

Files with missing lines Patch % Lines
src/variable.jl 0.00% 7 Missing ⚠️
src/num.jl 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #1398      +/-   ##
=========================================
+ Coverage    3.95%   6.44%   +2.48%     
=========================================
  Files          51      51              
  Lines        4824    4842      +18     
=========================================
+ Hits          191     312     +121     
+ Misses       4633    4530     -103     

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

@AayushSabharwal
Copy link
Contributor Author

The NaNMath error is trivial. The others I can't seem to replicate outside of running tests.

@AayushSabharwal
Copy link
Contributor Author

This will also fix MTK.

src/num.jl Outdated
@@ -25,6 +25,8 @@ SymbolicUtils.@number_methods(
Num(f(value(a), value(b))),
[conj, real, transpose]
)

NaNMath.pow(x::Num, y::Integer) = wrap(NaNMath.pow(unwrap(x), y))
Copy link
Contributor

Choose a reason for hiding this comment

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

We dont't want that. It should just fall back to ^.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not? @number_methods above already defines NaNMath.pow this way

Copy link
Contributor

Choose a reason for hiding this comment

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

Because NaNMath.pow returns floats for integer arguments in NaNMath < 1.0.2 which breaks eg Catalyst (see the issue in SymbolicUtils) and NaNMath >= 1.0.2 just falls back to ^ if the second argument is an Integer. So directly using ^ is the only way that works with all NaNMath versions and is what NaNMath does anyway in newer versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the clarification, I just saw your comments on the SymbolicUtils PR.

@AayushSabharwal AayushSabharwal force-pushed the as/fast-substitute-array branch from 4cdb222 to 1ea3df5 Compare January 10, 2025 06:57
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.

4 participants