Re: [eigen] AutoDiffScalar

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]




2009/10/20 Björn Piltz <bjornpiltz@xxxxxxxxxxxxxx>
I've done some more testing and got the class to work for
fixed/dynamic/sparse cases 1st and 2nd derivatives.
There are some minor bugs in the code and I had to rewrite
CompressedStorage to handle non-POD data types(evil memcpy's).
You are obviously still working on the code, so I was wondering how I
should submit any fixes.
Clone the repository and submit a  patch queue/pull request?

excellent!

I also have a couple of local changes improving the supports for second order derivatives so I think currently the best is that you create a fork on bitbucket and push your changes into it and then I'll do the merge(s).

 
There is also the question of performance. For second and higher order
derivatives There is a need to differentiate the type Scalar from the
underlying primitive type. let's call it Real for now.

E.g.

typedef AutoDiffScalar<Matrix<double, Dynamic, 1> > D1;
typedef AutoDiffScalar<Matrix<Fad1  , Dynamic, 1> > D2;

D1::Scalar == double
D1::Real   == double

D2::Scalar == D1
D2::Real  == double

Then the overloads should be
AutoDiffScalar OP AutoDiffScalar::Real
instead of
AutoDiffScalar OP AutoDiffScalar::Scalar

That should lead to resize()/zero() being called significantly less often.


yes I agree. To make that working we have to specialize struct ei_scalar_product_traits<A,B> for Real/AutoDiffScalar pairs such that Eigen knows the return type of this product.

Also I found that our scalar multiple functors stored the scalar factor by value. However, when the scalar type is an AutoDiffScalar, this led to many useless memory allocations and matrix copies.

gael.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/