Re: [eigen] MatrixX multiply

[ Thread Index | Date Index | More Archives ]

Hi Benoit,

thank you for your advise. I have one additional question: Does Eigen support m*n matrices or is it limited to n*n matrices ?

If it supports m*n matrices, how would I use the size()  function to determine the number of rows and columns?


You can certainly do it, but there's a faster way: Eigen allows you to
directly access the elements in the array of matrix entries, by
operator[]. You can take advantage of it here, i.e. do a single loop like

        for( int i = 0; i < size()*size(); i++ )
                result_matrix[i] = matrix1[i] * matrix2[i];

As a side-note: if you know at compile-time the size of your matrices and
if this size isn't too big, you'll get much, much better performance with
fixed-size matrices, i.e.

Matrix< float, Size > or Matrix4f instead of MatrixXf.


Mail converted by MHonArc 2.6.19+