Re: [eigen] pairwise multiply
• To: eigen@xxxxxxxxxxxxxxxxxxx
• Subject: Re: [eigen] pairwise multiply
• From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
• Date: Sat, 20 Nov 2010 20:53:53 +0100
• Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=SdlINMPK+K4ClwFQu3Ru36ibqBaNDgv0UORu2vXAWWeATU7fliObY6lI8cLDDntuSR 1ZOkpRgPymaaAHTugZXn4F/hd0zXTH9Y5wPTqNgFYZ3Xu7YZ29lQ4/eID0DQc2BC1ydz i41JfRcLPFXvGHQjvYiqXSnTZ+OfjPDRFAE5o=

```to be more precise, you can:

1 - use Array from the beginning (in case you are not interested in
the linear algebra world):

a3 = a1 * a2;

2 - use the cwiseProduct() method:

m3 = m1.cwiseProduct(m2);

3 - use the .array() modifier:

m3 = m1.array() * m2.array();

gael

On Sat, Nov 20, 2010 at 8:36 PM, Jose Luis Blanco
<joseluisblancoc@xxxxxxxxx> wrote:
> 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
>>
>
>
>

```

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