Writing AD rules for Rotations.jl

I’m trying to create a coordinate transformation, via LinearAlgebra and Rotations.jl (Home · Rotations.jl), and can be optimized via Zygote.jl, or the like.

I’m running into a problem because some of the functions in Rotations.jl (RotZ(), MRP()) don’t have automatic differentiation (AD) rules, and I have to write my own. Rotations.jl comes with the Rotations.jacobian() function, which can be applied to rotation functions, but I’m having trouble getting the syntax right for ChainRules.jl

Because its just linear algebra, I’ve implemented some simpler functions to work around this problem, but getting Rotations.jl working would be much more elegant.

Any advice or concrete examples would be greatly appreciated.

Welcome! Can you give a concrete example of a rule which doesn’t seem to work?