Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rrule for * and add support for constant operations #211

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

blegat
Copy link
Member

@blegat blegat commented Apr 20, 2022

I am a bit unsure what to do here. I think we should define rrule based on LinearAlgebra.dot so we should remove the definition of the rule for differentiate and keep the old one for *.

@harris-mit I would expect that the current rule for differentitation gives incorrect result when you use it with AD since it assumes a scalar product that is not what is used, does it work for you ?

#ΔΩ = ChainRulesCore.unthunk(Ω̇)
#return (ChainRulesCore.NoTangent(), ChainRulesCore.ProjectTo(p)(ΔΩ * q'), ChainRulesCore.ProjectTo(q)(p' * ΔΩ))
return (ChainRulesCore.NoTangent(), ΔΩ̇ * q', p' * ΔΩ̇)
return (ChainRulesCore.NoTangent(), adjoint_mult_right(q, ΔΩ̇), adjoint_mult_left(p, ΔΩ̇))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous definition was correct for the scalar product dot(p, q) = p * q, the current one is correct for the scalar product dot(p, q) = dot(coefficients(p), coefficients(q)) (assuming they have the same monomials).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This second scalar product corresponds to the _dot we use for testing differentiate. This means that for differentiate we assume the other scalar product

@blegat blegat force-pushed the bl/chain_rule_constant branch 2 times, most recently from 4ecd160 to 15315c8 Compare December 26, 2022 14:34
@blegat
Copy link
Member Author

blegat commented Jul 26, 2023

@oxinabox this is the issue I mentioned to you at JuliaCon

@oxinabox
Copy link

@sethaxen might have thoughts here

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