Re: [eigen] Array cwise multiplication

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


2010/9/29 Carlos Becker <carlosbecker@xxxxxxxxx>:
> Hi all, I was trying to code something like this:
> #include <Eigen/Dense>
> using namespace Eigen;
> using namespace std;
> int main()
> {
> MatrixXf a;
> VectorXf b;
> a.resize(2,4);
> b.resize(2);
> a << 1,2,
> 3,4,
> 5,6,
> 7,8;
> b << 1,2;
> a = a.array().colwise() * b;

Here you're multiplying an array by a matrix.

Doesn't a.colwise() * b work?

Benoit

> return 0;
> }
> Should this compile correctly? I want to multiply every column in matrix a,
> element-wise, with vector b, but I cannot make it work
> I hope I am not forgetting about something important here.
> Cheers,
> Carlos



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