Re: [eigen] Array cwise multiplication |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Array cwise multiplication
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 29 Sep 2010 10:41:10 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=SjQv8ZmRUsyZxyT2JG/efbRPZfDPQ/7LP4+u+zv6ca0=; b=TEXatqn0GL7mswZnlC48hvsstXOs5OnwLIlvrx7Jgl9Kr33rP6busuWmh3Y8P1Sccl nTVt1SsyoY/d0NijcvAC37BGk/EBHgpnNOM+LnF5YMDIhluKYfgS4emAprEBH4Lwhe03 SAOCstoEhVrDki0BoLT0WNYI0WO62X4F+1yKY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=mz9ygrKFxMjGve6w9/hsO7S0a5gSEO6cO6RNyZkKnAGxMYSIrRH0n68zWMe0j/irJM FPU1tI/fYh0v+N9AuzPT0cqJl9mXoFsjSHzmrDPKpUXb1h4950+hgxwoIGFY9AArMZxf 8oS5kP2W1SjoZxkJGwCuWAGNjPFVHk8+MpMIg=
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