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

Extending AutoDiffScalar

Tags: None
(comma "," separated)
plistov
Registered Member
Posts
2
Karma
0

Extending AutoDiffScalar

Mon Aug 03, 2020 2:00 pm
Hello everyone,

I have been trying for sometime to put my head around a way to extend the AutoDiffScalar class. I understand that for additional functions it is enough to inherit from AutoDiffScalar and then use their MACRO to register new functions.

The assignment looks trickier. So far one can assign matrix of AD scalar to a numerical matrix but not the other way around:
Code: Select all
using ADScalar =  AutoDiffScalar<Matrix<double, 5, 1>>;
Matrix<ADSalar, 5, 1> ad_vec;
Matrix<double, 5, 1> vec;
ad_vec = vec;  // works
vec = ad_vec;  // not allowed - assignment is not defined

For now, I have to iterate over all 'ad_vec' coefficients to fill in 'vec' loosing advantages of vectorisation. Does anyone has an idea how to implement a more efficient assignment?

Thanks,
Peter


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]