JuliaDiff / JuliaDiff/ForwardDiff.jl

support for `Base.expm` (need advice implementing)

Open
#174 17 comments 3 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

It would be very nice to have support for AD in Base.expm. I would like to contribute to it, but since I am unfamiliar with the AD architecture in Julia I would appreciate some advice.

For Frechet derivatives, the recommended approach is Al-Mohy and Higham (2009). But I am unsure that this is the best approach for AD.

I came across an article by Mike Giles on AD and matrix functions. Section 2.3.5 in this paper suggests that if one uses the squaring and scaling algorithm, AD calculations just amount to the solution of linear systems and matrix powers, both of which go through nicely.

Base.expm! uses Julia functions, except for two LAPACK ones, gebal! and gesv!, for balancing and solving linear systems, respectively. I am under the impression that AD already goes through linear systems, so it could be replaced. So all one would need to do is implement gebal in Julia, and replace gesv! by \, perhaps at the cost of some extra allocation.

Am I on the right track with this?

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 reading Base.expm! and the Julia AD handling for linear systems, especially the gebal! and gesv! calls mentioned in the issue. Compare the squaring and scaling approach with the cited Frechet-derivative and Giles references. Done means establishing a decided implementation path and adding AD support for Base.expm.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.