This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Nested typedef in NumTraits for custom scalar type

Tags: None
(comma "," separated)
pjsa
Registered Member
Posts
15
Karma
0
Can someone please provide some more information about the Nested typedef in NumTraits?

Specifically, in NumTraits<AutoDiffScalar<DerType> > why is it a reference:
typedef AutoDiffScalar<DerType>& Nested;

I am using a modified version of the AutoDiffScalar class to compute second derivatives and DerType is itself a fixed size Eigen::Matrix of AutoDiffScalars. In this case I am getting some strange errors that I can't explain. For example I can print the values of the derivatives inside a function such as sqrt and see that they are correct, but the returned value has garbage.

However if I remove the "&" from the Nested typedef everything seems to be working.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar