Skip to content

Add additional Jacobian tests (including sparsity) #1211

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

Merged
merged 3 commits into from
Apr 7, 2025
Merged

Conversation

TorkelE
Copy link
Member

@TorkelE TorkelE commented Apr 2, 2025

After the latest test failures in the spatial tests I checked and realised that we don't actually properly test whether the generated sparse Jacobians are correct. I guess, ironically, a lot of the core feature tests were written way back in time before when we made more assumptions of upstream correctness (and our own, I guess, still think the early tests were quite good though). Hence a lot of stuff is actually caught in extensions/niche feature tests that are actually testing other stuff.

I haven't actually isolated the latest problems, so not sure if they are from Catalyst or somewhere else (or even if they are a problem). However, we get failures here as well, so not related to the spatial stuff that is actually failing. I also only get failures of these tests on the latest version, so it is something recent that has happened.

@TorkelE
Copy link
Member Author

TorkelE commented Apr 2, 2025

This is the likely culprit SciML/OrdinaryDiffEq.jl#2567

@TorkelE TorkelE closed this Apr 2, 2025
@TorkelE TorkelE reopened this Apr 2, 2025
@isaacsas isaacsas closed this Apr 3, 2025
@isaacsas isaacsas reopened this Apr 3, 2025
end

# Checks that the Jacobians (dense and sparse) are identical for different system types.
Copy link
Member

Choose a reason for hiding this comment

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

Do you ever test against a custom hand-coded Jacobian we know is right? That would be good to have in at least one case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we do (right now that's basically the only Jacobian tests we do actually): https://github.com/SciML/Catalyst.jl/blob/master/test/simulation_and_solving/jacobian_construction.jl

However, we do not do this for sparse though.

Copy link
Member

Choose a reason for hiding this comment

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

We should check sparse against the exact Jacobian, but I don't think we need an "exact" Jacobian that returns a sparse matrix (i.e. checking the Catalyst-generated sparse vs. a hand dense is fine).

@isaacsas
Copy link
Member

isaacsas commented Apr 3, 2025

Feel free to merge if tests pass and you are happy.

@TorkelE TorkelE closed this Apr 7, 2025
@TorkelE TorkelE reopened this Apr 7, 2025
@ChrisRackauckas
Copy link
Member

I wouldn't worry too much about pre since it's now actually on the pre-release, though that fail is odd . Let blocks are stronger scoped in the next release because of the globals changes, and so we've seen that causes changes in eval / RGF handling. I don't see why that would be related here because I don't see eval at all though...

@TorkelE TorkelE merged commit 0d6b76a into master Apr 7, 2025
23 of 27 checks passed
@TorkelE TorkelE deleted the add_jac_tests branch April 7, 2025 13:29
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.

None yet

3 participants