Re: [eigen] pairwise multiply |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] pairwise multiply
- From: Jose Luis Blanco <joseluisblancoc@xxxxxxxxx>
- Date: Sat, 20 Nov 2010 20:36:44 +0100
- 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=thIw0YdkmADR06uy1EmdwcIM6ezeO0YQXN08twp95qA=; b=xJBXYxrmOetVj2ZOyLEaNScG8mw87enxBD09Ebz4Y/cJtgP9FAlsCurz/UtCFyWCQf 3Pw2kSxzW6tD9LqzJB9qizF6rFB9Ku2TZrbgWRsck7SjkgMcAkDrRRH7rsCnujep60vc 90Zpm+glE1cyrX5EHqdxufWSRJICaVnyDy6js=
- 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=GwXrJick8AGlbGD3tSaxFD50N9aHhJ4LF3IKd4X5R3HlUCTQWPHIczFV5I30PMZLyy mMfBF/7lCg09raTY0TzZdt+1EY++vcqkcncBONL807nsUu+QDE8mEPcVnbytbFShtmMi jiVrFT8cZ5MCMu7bckzaplPqHx7dRq9cBn5PI=
It can be done with:
RESULT.array() = A.array() * B.array();
If you use it a lot, you could write something like:
template <class A,class B,class RES>
inline void dotProd(const A &a,const B& b, RES &res)
{
res.array() = a.array() * b.array();
}
dotProd(A,B,RES);
JL
On Sat, Nov 20, 2010 at 7:47 PM, Andy Somogyi <andy.somogyi@xxxxxxxxx> wrote:
> Hello Eigen guys,
>
> Would it be possible to add a pairwise matrix matrix multiply i.e. the ".*" operator in matlab to the Eigen MatrixBase class. I use this operator a lot.
>
> thanks
>