Add batch/vectorized finite difference Jacobian evaluation#211
Open
ChrisRackauckas-Claude wants to merge 1 commit intoJuliaDiff:masterfrom
Open
Add batch/vectorized finite difference Jacobian evaluation#211ChrisRackauckas-Claude wants to merge 1 commit intoJuliaDiff:masterfrom
ChrisRackauckas-Claude wants to merge 1 commit intoJuliaDiff:masterfrom
Conversation
Implements feature requested in JuliaDiff#210: allows computing the full Jacobian in a single batched function call instead of N sequential calls. This is useful for GPU-parallelized functions that can evaluate multiple inputs simultaneously. Adds `batch=true` keyword to `finite_difference_jacobian` and `finite_difference_jacobian!`. When enabled, `f` receives a matrix where each column is an input point and returns a matrix of outputs. Supports forward, central, and complex step methods. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #210.
batch=truekeyword argument tofinite_difference_jacobianandfinite_difference_jacobian!batch=true, the functionfreceives a matrix where each column is an input point, and should return a matrix where each column is the corresponding outputf(FX, X)receives output matrixFXand input matrixXf, enabling GPU-parallelized or otherwise vectorized evaluationImplementation details
Out-of-place (
finite_difference_jacobian):n×(n+1)matrix (base + n perturbations) orn×niff_inprovided → 1 call tofn×2nmatrix (forward + backward perturbations) → 1 call tofn×nmatrix → 1 call tofIn-place (
finite_difference_jacobian!):f(FX, X)fills the pre-allocated output matrixExample usage
Test plan
🤖 Generated with Claude Code