|[eigen] refactoring fork: some news|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] refactoring fork: some news
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Fri, 18 Dec 2009 10:53:48 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=nHu5Fdc6bs24nOGxfCO3RjwvhPGKBzpAFQjWgLT2Hx8=; b=P5mMi1lCPqI8g4g0zfx1iD1H9LFMl57pTZ1CV83xNnQ9TcFd6Rj4OXT9uD/ypjwNcn 5z268PKHFmxTx2xkYvWP329T7F69zCQYv9vdev+cLv6gqlfZt3FdHryL0LbRr7u0qbyH dm9jYoJDPLU8D3APLtQoPxw3SyEX0xUDera5c=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=kqJJpW4pLjxzHcoJSYl9qUJB0/NiYa/HVskhYlpEiXapzRea2wqZvwxdnPmSWJLkGC MgpUrfGtYFqGqnOEK3qAtNcXYsuHyi6X2rhdPiP5HW1KJsLXVRdJT+ZUp7JW3UjuMKSd uyDyp01b30uEVQduopXgecf7uiTgdf/Kg4cgc=
some news from my fork: http://bitbucket.org/ggael/eigen2-et-refactoring/.
Let me first recall that the initial goal of this fork was to refactor our _expression_ template tree so that is becomes easier to add and use new matrix types. In the same time I've added a true support for "Array" and started to clean the sparse module thanks the new possibilities offered by the new design. So in order to achieve this goal while minimizing code redundancy as much as possible, I've employed a couple of different mechanisms which are summarized on the following self explanatory scheme:
http://eigen.tuxfamily.org/misc/eigen_new_design.xml (requires umbrello)
Note that's not at all an UML diagram, I just tried to quickly picture all the major aspect of this new design on a single diagram. I hope it is clear enough, otherwise feel free to ask for precisions.
In this fork I also moved all deprecated features to a new Eigen2Support module (i.e., lazy(), marked(), .cwise(), etc.) In order to enable Eigen2 compatibility you can either do:
- #include <Eigen2Support> before any other Eigen header
- #define EIGEN_EIGEN2_SUPPORT before any other Eigen header (in this case you don't have to #include Eigen2Support)
Feel free to propose another solution.
Currently the fork is good enough to pass all the unit tests, but it still requires a lot of work regarding cleaning, documentation, and the unit tests have to be extended to check for Array objects. But before going further I'd like to hear your opinion about this new design.
Another question: how to name the predefined typedef for Array ? The problem is to distinguish 1D and 2D array. So for I've use the following convention:
Array33f => 2D 3x3 Array of float
ArrayXXf => 2D dynamic Array of float
Array3f => 1D Array of float of size 3
ArrayXf => 1D dynamic Array of float
but that's not consistent with Matrix's typedefs. Any idea?
Still about Array, let me recall that we agreed upon removing .cwise() in favor of a few cwiseXXX function for Matrix objects (e.g., mat.cwiseProduct(mat), mat.abs()), plus a MatrixBase::array() function allowing to see a matrix as an Array, e.g.:
For the other way round, i.e., to see an Array as a Matrix I used the function asMatrix() because some expressions already defined a .matrix() function, that is not consistent. So do you prefer to stick with .array()/.matrix() (in which case we have to rename the matrix() function of some expressions), or finallydo you prefer the more explicit but more verbose .asArray()/.asMatrix() names ? or perhaps toArray()/toMatrix() or .arrayView()/.matrixView() ??