JuliaDiff / JuliaDiff/ForwardDiff.jl

Using ForwardDiff with a vector function (as in IntelVectorMath)

Open
#440 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
1k
Forks
160
PR merge metrics
No merged PRs in 30d

Description

Is there any way to efficiently use ForwardDiff with functions that operates on vectors and return vectors? Suppose I have a function f that operates on a vectors by applying some operation independently to each element (as in a broadcast operation). This, for example, is the case for many functions from IntelVectorMath or AppleAccelerate. Although, formally, f is a function from R^n to R^n, in reality it does not make sense to compute an Hessian for it, since it would be a diagonal matrix. Is there a way to have ForwardDiff return only diagonal elements?

Note that repeated calls to ForwardDiff.derivative, although feasible, would be a poor workaround, since would not allow me to use the fast math operations of IntelVectorMath or AppleAccelerate.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing ForwardDiff.derivative and the handling of vector-valued functions. Compare the requested behavior with the elementwise operations provided by IntelVectorMath or AppleAccelerate. Done means identifying a supported efficient way to return only diagonal derivatives without repeated scalar derivative calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.