Re: [eigen] Vectorwise dot product feature request

[ Thread Index | Date Index | More Archives ]

That looks suspiciously like a transposed multiply to me....


On Wed, Jul 7, 2010 at 1:59 PM, Johan Pauwels <johan.pauwels@xxxxxxxxxxxxx> wrote:
Hello all,

Would it be possible to allow a vectorwise dot product as in the example below?

#include <Eigen/Core>

int main()
   Eigen::MatrixXf mat = Eigen::MatrixXf::Random(5,2);
   Eigen::VectorXf vec = Eigen::VectorXf::Random(5);
   Eigen::RowVectorXf result(2);

   // this syntax
   result = mat.colwise().dot(vec);
   // instead of this for loop
   for (int i = 0; i < mat.cols(); ++i)
       result[i] = mat.col(i).dot(vec);


Mail converted by MHonArc 2.6.19+