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

Rework VecJac Operator #272

Merged
merged 2 commits into from
Nov 5, 2023
Merged

Rework VecJac Operator #272

merged 2 commits into from
Nov 5, 2023

Conversation

avik-pal
Copy link
Contributor

@avik-pal avik-pal commented Nov 1, 2023

  • p and t are no longer dropped
  • VecJac matches the size of $J^T$
  • Non-square jacobian is constructed if we pass in fu

I will test with SciML/NonlinearSolve.jl#268 a bit before merging

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (7d23bec) 87.08% compared to head (635828a) 86.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #272      +/-   ##
==========================================
- Coverage   87.08%   86.62%   -0.46%     
==========================================
  Files          21       21              
  Lines        1254     1286      +32     
==========================================
+ Hits         1092     1114      +22     
- Misses        162      172      +10     
Files Coverage Δ
ext/SparseDiffToolsZygoteExt.jl 100.00% <100.00%> (+2.63%) ⬆️
src/differentiation/vecjac_products.jl 80.80% <75.00%> (-11.38%) ⬇️

... and 1 file with indirect coverage changes

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

@avik-pal
Copy link
Contributor Author

avik-pal commented Nov 1, 2023

This might have to be a breaking change. The previous API dropped things and a lot of code was written to work around it. But now the API is more strict which breaks code 😞

Comment on lines 55 to 70
## Allowed Function Signatures

For Out of Place Functions:

```julia
f(u, p, t) # t !== nothing
f(u, p) # p !== nothing
f(u) # Otherwise
```

For In Place Functions:

```julia
f(du, u, p, t) # t !== nothing
f(du, u, p) # p !== nothing
f(du, u) # Otherwise
Copy link
Member

Choose a reason for hiding this comment

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

Does this match jacvec?

Copy link
Member

Choose a reason for hiding this comment

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

Where is v?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That also drops p and t after asking from them. JacVec basically only allows f(du, u) and f(u). So this one is a strict superset

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I always pass in the general function and then get an error that f can't take p or t as inputs, which is kind of weird to do if the function takes them as inputs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where is v?

Oh I see the confusion. I meant to say function signatures for the input and not the constructed operator

Comment on lines +86 to +88
# FIXME: FunctionOperator is terribly type unstable. It makes it `::Any`
# NOTE: We pass `p`, `t` to Function Operator but we always use the cached version from
# VecJacFunctionWrapper
Copy link
Member

Choose a reason for hiding this comment

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

Sounds like the right thing to do is fix FunctionOperator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the note part or the fixme part? The fixme part definitely needs fixing, but the note part is needed, because p and t need to be propagated via update_coefficients

@ChrisRackauckas ChrisRackauckas merged commit 2b7aae7 into JuliaDiff:master Nov 5, 2023
13 of 18 checks passed
@avik-pal avik-pal deleted the ap/fix_nonsq_vecjac branch November 5, 2023 20:56
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