Re: [eigen] Eigen containers cannot be vectorized

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


It is indeed a solution.

The nice thing about the solution I propose is that it could also work “out of the box”.

François Fayard
Founder & Consultant - Inside Loop
Applied Mathematics & High Performance Computing
Tel: +33 (0)6 01 44 06 93
Web: www.insideloop.io

On Dec 8, 2016, at 2:43 PM, Joseph Mirabel <joseph.mirabel@xxxxxxx> wrote:

Hi,

what about this:

#include <Eigen/Dense>

void f(Eigen::Matrix<Eigen::Index, Eigen::Dynamic, Eigen::Dynamic>& A) {
 const Eigen::Index cols = A.cols();
 const Eigen::Index rows = A.rows();
 for (Eigen::Index j = 0; j < cols; ++j) {
   for(Eigen::Index i = 0; i < rows; ++i) {
     A(i, j) = i + j;
   }
 }
}

Best rgds,
Joseph



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