Skip to content

add Base.sinc rule - #255

Merged
nickrobinson251 merged 4 commits into
JuliaDiff:masterfrom
stevengj:patch-1
Aug 29, 2020
Merged

nickrobinson251 merged 4 commits into
JuliaDiff:masterfrom
stevengj:patch-1

Conversation

@stevengj

Copy link
Copy Markdown
Contributor

I recently became aware that Julia Base defines a cosc function to be the derivative of sinc, so it seems worth adding this rule (especially since naive differentiation of sinc leads to an implementation that is numerically unstable: JuliaLang/julia#37227).

@nickrobinson251

nickrobinson251 commented Aug 29, 2020 •

Copy link
Copy Markdown
Contributor

Thanks! please can you add a test (e.g. to

@testset "Trig" begin
) and bump the Project.toml version number? :)

@stevengj

stevengj commented Aug 29, 2020 •

Copy link
Copy Markdown
Contributor Author

I added a test. Since you are pre-1.0, how do you want to increment the version number? Bump the patch version?

@nickrobinson251

nickrobinson251 commented Aug 29, 2020 •

Copy link
Copy Markdown
Contributor

Bump the patch version?

yes :D Thanks!

@stevengj

Copy link
Copy Markdown
Contributor Author

Test failure seems unrelated?

tuple getindex: Error During Test at /home/runner/work/ChainRules.jl/ChainRules.jl/Zygote.jl/test/features.jl:318
  Test threw exception
  Expression: gradient((x->begin
                sum((size(x))[1:2:3])
            end), ones(2, 2, 2, 2)) == (nothing,)
  Mutating arrays is not supported

@nickrobinson251

nickrobinson251 commented Aug 29, 2020 •

Copy link
Copy Markdown
Contributor

Test failure seems unrelated?

Agreed - seems like Zygote master is broken.

Thanks for this! LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants