Moderator
|
I opened a bugzilla entry for this: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=634
|
Registered Member
|
Hello Alex,
once more me, did you ever tried sin(), exp() or log() etc. in the function definition? If I do
in your above example I get the runtime error
Any hints? Thanks Ralf PS: Sorry for capturing your topic |
Registered Member
|
For the sake of self-learning, I tinkered with generalizing nth-order autodiff'ing for a simple SISO case, basing off of Alex's example and some from drake:
https://github.com/RobotLocomotion/drak ... ff_types.h https://github.com/RobotLocomotion/drak ... autodiff.h I've uploaded the code here: https://github.com/EricCousineau-TRI/re ... der.cc#L15 Snippets
Will see if I can recreate your 2x2 Hessian case. |
Registered Member
|
In browsing this Wikipedia article:
https://en.wikipedia.org/w/index.php?ti ... _variables One of the authors of the paper, [9] at present, (and I believe, editors of the article ) linked to their source code for implementing the tensor operations mentioned for extending to nth order derivatives: https://github.com/ZigaSajovic/dCpp Will tinker with this over the next couple of months. EDIT: Oops. Most likely did my math wrong, and the below reduction probably won't work. EDIT2: Yup, it missed the inner product for the 2nd order case. Will leave this here for posterity's sake. Also, as I was trying to generalize duplication for the 2+th order case, I think we can avoid the duplication if the class definition can be changed from:
to something more explicit:
That way, instead of doing dual math like: <<u, u'>, <u', u''>> ^ (with the present structure, kind of like ODE-style integration... but hyper redundant for 3+ orders) we can instead just nest directly: <u, <u', u''>> I believe this should hold for an arbitrary number of derivatives as well. I'll try this out over the next few days, and see if this can be turned into a potential enhancement. I saw a template structure like this with AutoDiffVector, but given that (a) it is not included in the <unsupported/Eigen/AutoDiff>, and (b) that it appears to be syntactic sugar for grouping derivatives more concisely (at least when looking at the explicit indexing in the rest of the code), I'll try modding the original AutoDiffScalar definition. (That, and I'm not entirely sure what AutoDiffJacobian is doing... Just started tinkering with AutoDiff in the past month.) |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]