|Re: [eigen] AutoDiffScalar|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] AutoDiffScalar
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 20 Oct 2009 14:37:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=w51u0hTLLnlbbGv5aYzOjcgHEqRiMhUO1SzyAgJlOR0=; b=ZBGXXg78GPPgQhMDOT1kbfivzWm8dzRMoXpTuwwCCAVbDwatwf8lOhII70Xqqy9GEP G5waSUlU9QSFyRdvUnwaMxeJcFil2Ba4U0PdQA2UU+6vSvPWg7QGDdyOubAbd9XlAb37 xjMxDAO515n2chNQnVIvexs8TfAdnj+uEKSws=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=F8bx5CvY1WYhEi6KKkIOwwFwLXw9uN1A5XERhqi9dpit6/iKz+46IhosxlFEpwLr0q ZuU+33UCxXu4H62MZD2Xb9CLRuApTFhYXuQIuakn/EJlvcD10AiZhUjOA0tXrr0t1oeb ztS+V8YKeohsqiNormefSIxaHHHlJXzktoh0I=
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?
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.
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
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.