-
-
Notifications
You must be signed in to change notification settings - Fork 41
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: use DI for structured Jacobians #470
Conversation
Structure is indeed preserved for decompression (on the SparseMatrixColorings PR branch at least). |
end | ||
|
||
function JacobianCache(prob, alg, f::F, ::Number, u::Number, p; stats, | ||
autodiff = nothing, kwargs...) where {F} | ||
fu = f(u, p) | ||
if SciMLBase.has_jac(f) || SciMLBase.has_vjp(f) || SciMLBase.has_jvp(f) | ||
return JacobianCache{false}(u, f, fu, u, p, stats, autodiff, nothing, nothing) | ||
return JacobianCache{false}(u, f, fu, u, p, stats, autodiff, nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question about cases where DI preparation is skipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only where the user provides an analytic jacobian. This one is a special case for scalars when DI is skipped if jacobian/jvp/vjp is provided.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Seems to work beautifully. Haven't benchmarked yet, but the important part here is to ensure structure is preserved, since the main cost in these workloads is that Linear solving will be bottlnecked if a banded matrix is converted into a sparse matrix.