[eigen] Switched libmv to Eigen2; some thoughts and questions. |

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

*To*: libmv-devel <libmv-devel@xxxxxxxxxxxxxxxx>*Subject*: [eigen] Switched libmv to Eigen2; some thoughts and questions.*From*: "Keir Mierle" <mierle@xxxxxxxxx>*Date*: Sat, 15 Nov 2008 13:53:20 -0800*Cc*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:mime-version:content-type; bh=RRdTL3UgEuISaadjFG5X4TE5gGYCi22lawnA+3zeSsg=; b=B8I52hHaHu+KHcJ58dya/st4BkNGodDJO3By/LAzDekRm64Pb2r810MSC+1BhXsFGR O5pTbSu45Nmd+ZqK6ucKBzlKrdXeRzSsyoChdN/zRz9J2xegaepDHc1RM8d0uKD/mAOC fjX1HCRGtAy57LcCPursiCQP68Wx2xtyLSi9s=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type; b=jrN2xOMuVYyM/t8HcrNiAqAfsZy5XzFoQiK8sHUHVdyTZIBJ4ChCUPANu3p/uDECuB hZCALwk4UR3YCYQVvaKD2bLA9AgcrpAO/0dQYJ2FVZtb8ekkzzClc875IE74TWpmenEj TRomCEaRUO9fC2qwSmm3avee6nonUtNTq3Ei8=

I switched libmv to Eigen2 from FLENS. I got to delete quite a bit of code in the process. Also, I ported the FLENS tests over to Eigen2 to ensure the functionality we are using works; which it all did with no local modifications. I am excited about not needing local modifications! The only non-superficial change I had to make was for libmv's Nullspace() call, which finds the nullspace of a possibly wide matrix for solving homogenous equations, to pad the matrix A in Ax=0 with zero rows to make A square, when A is wide. Benoit suggested the LU's kernel() function, which I will investigate next though I am unsure if it is as stable as the SVD method.

Thoughts: The compile and errors from Eigen2 were much better than with FLENS. The fixed size and dynamically sized matrices worked together flawlessly, requiring no fixes to Eigen2. There were no surprising aliasing effects; Eigen2 Does The Right Thing with respect to possibly aliased matricies. The array type functionality is quite convenient. Eigen2 expressions are concise and readable; much more so than with FLENS where it is necessary to make explicit temporaries (rather than letting the compiler decide if temporaries are necessary). For example, it's really nice that you can do (A*x + b).norm2() inline, without the boilerplate. I expected compile times to be really bad, they weren't. One of the best things about using Eigen2 is that we get better than MKL or ATLAS performance, while eliminating dependencies on crufty old FORTRAN libraries that aren't installed everywhere. That's really fantastic; getting the right LAPACK version is hard.

Overall I am quite impressed. Great job guys!

I spent a bit of time hacking the SVD code to extract the first part (bidiagonalization) but didn't end up finishing it because I wasn't sure what the right way to avoid copying the resulting U and V matrices. If you make a function Bidiagonalize(Matrix *A, Matrix *U, Vector *diagonal, Vector *super_diagonal, Matrix *V), where U and V can be passed as NULL to avoid computing them, you can't do 'local' typedefs to remove some of the template complexity like you can with a class. So I am not sure what the right approach is here. Also, the current SVD algorithm supports avoiding computing U and V, but does not expose this; I am not sure what the best way to extend the API is.

One issue with Eigen2 is that the default formatting for output is not very nice. I may make local modifications so that the array display is matlab- and python- copy & pastable (and has aligned columns). I am not sure what benefit the current format has over a more conventional display format. Also, some of the examples in the docs are hard to understand because the example output matrices are not aligned (does that have 3 or 4 columns?).

Going forward I am excited to work with Eigen2.

Cheers,

Keir

**Follow-Ups**:**Re: [eigen] Switched libmv to Eigen2; some thoughts and questions.***From:*Benoît Jacob

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] SVD for finding a basis for the nullspace of a wide matrix** - Next by Date:
**Re: [eigen] Switched libmv to Eigen2; some thoughts and questions.** - Previous by thread:
**Re: [eigen] SVD for finding a basis for the nullspace of a wide matrix** - Next by thread:
**Re: [eigen] Switched libmv to Eigen2; some thoughts and questions.**

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