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 array variables in linear_expansion #1320

Conversation

AayushSabharwal
Copy link
Contributor

Before:

julia> @variables x(t)[1:2] y(t)
julia> @parameters f(::Vector{Real})
julia> @mtkbuild sys = ODESystem([D(x) ~ x .* y, y ~ sum(x)], t)
┌ Warning: Internal error: Variable (x(t))[1] was marked as being in 0 ~ -y(t) + Symbolics._mapreduce(identity, +, x(t), Colon(), (:init => false,)), but was actually zero
└ @ ModelingToolkit.StructuralTransformations ~/Julia/SciML/ModelingToolkit.jl/src/structural_transformation/utils.jl:237
┌ Warning: Internal error: Variable (x(t))[2] was marked as being in 0 ~ -y(t) + Symbolics._mapreduce(identity, +, x(t), Colon(), (:init => false,)), but was actually zero
└ @ ModelingToolkit.StructuralTransformations ~/Julia/SciML/ModelingToolkit.jl/src/structural_transformation/utils.jl:237
Model sys with 2 equations
Unknowns (2):
  (x(t))[1]
  (x(t))[2]
Parameters (0):

After:

julia> @mtkbuild sys = ODESystem([D(x) ~ x .* y, y ~ sum(x)], t)
Model sys with 2 equations
Unknowns (2):
  (x(t))[1]
  (x(t))[2]
Parameters (0):

There are also cases where structural_simplify would create DAEs instead of ODEs with those warnings but I can't remember how to MWE that yet.

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2024

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

Codecov Report

Attention: Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.

Project coverage is 79.00%. Comparing base (e036266) to head (408f5fe).
Report is 26 commits behind head on master.

Files with missing lines Patch % Lines
src/linear_algebra.jl 85.71% 3 Missing ⚠️

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

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1320       +/-   ##
===========================================
+ Coverage    3.80%   79.00%   +75.20%     
===========================================
  Files          47       47               
  Lines        4602     4721      +119     
===========================================
+ Hits          175     3730     +3555     
+ Misses       4427      991     -3436     

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

@AayushSabharwal AayushSabharwal marked this pull request as draft October 23, 2024 08:21
@AayushSabharwal
Copy link
Contributor Author

This is the wrong solution to the problem

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