JuliaArrays / JuliaArrays/DualArrays.jl

Do we want to support generators? (comprehensions, sum, etc.)

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is it possible to auto-diff the following:

julia> function mynorm(x)
       sqrt(sum(x^2 for x in x))
       end
mynorm (generic function with 1 method)

julia> mynorm([1,2,3])
3.7416573867739413

Or more generally, differentiate code with comprehensions ([x^2 for x in x]), minimum, etc.

This is hard since Generator uses anonymous functions.

map and broadcast also have this issue when passed an anonymous function. It's possible there's a work around by making a type BroadcastedDualVector that turns all the relevant function calls into broadcasted versions.

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 examining how DualArrays.jl handles anonymous functions and calls involving Generator, map, and broadcast. Determine the supported scope for differentiating comprehensions, sum, minimum, and related expressions, then add coverage showing which requested forms work and document the resulting boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.