JuliaDiff / JuliaDiff/FiniteDifferences.jl

Allow keyword arguments and skipping positional arguments

Open
#24 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
318
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Something I ran into in ChainRules was that FDM's j′vp currently cannot deal with non-numeric, non-differentiable arguments, nor can it deal with keyword arguments. One example of that is sum with a function argument and/or with the dims keyword argument. You can wrap it yourself like

FDM.j′vp(central_fdm(5, 1), x->sum(abs2, x, dims=1), ȳ, x)

but it would be nice to have a way to express this directly in the j′vp function signature.

To get around this limitation I implemented this monstrocity: https://github.com/JuliaDiff/ChainRules.jl/blob/master/test/test_util.jl#L53-L78, but that should never see the light of day beyond being used in tests.

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 at the j′vp entry point and read the workaround in test/test_util.jl, especially how it handles keyword and skipped positional arguments. Compare that approach with the current j′vp signature and the sum example using dims=1. Done means callers can express those arguments directly without a wrapper, with coverage for the demonstrated cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.