Re: [eigen] matrix-matrix pow() |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] matrix-matrix pow()
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Sun, 24 Jan 2010 21:25:17 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=4dn6NjhZhQ0FP2YxgV8Xq6lV9512DMAvMVDmAeCtIp4=; b=vAXXWYQNU9rOE19/7L7tucSc+nsyG51c4Ukw0x1QxhsrYX0XY1IzKT7G8lwz4+KisN RNTqqktNXdDvWVVMJc4vTE5U4QPLfSmu10XbJbmuOMSuEtU6pl/gEg4pwgBbXWvXXo7X BkpsHY9RgBxj8nrNyeuD0UzVrjNbEG6z0WZCY=
- 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; b=WHYlYKzq5eMPwNaZkXUv3xE4yr5ApjAywD7cyKtnXDo8Lu76YQD6PfqitgPAeCUdQ/ U5o12Gn5NkKCTDFv6Xyl3Cg+tFw8/9lNuQNkCKrNwLUGtvMsDwTpha0s+CJ/xQqiiGFd hCSVHmPyLrJkhwb1GVaQHh/h8jFL4KgsK9PH8=
actually this is quite straightforward to add it via EIGEN_CWISE_PLUGIN:
step 1 - define a functor like ei_scalar_sum_op in Core/Functor.h (no
need to implement the packet() method, and don't forget to add the
respective ei_functor_traits, again have a look at the Functor.h
file).
step 2 - in your plugin file add your template function like this:
template<typename OtherDerived>
CwiseBinaryOp<your_pow_functor<Scalar>, ExpressionType, OtherDerived>
ei_scalarpow(const MatrixBase<OtherDerived>& exponent) const
{
return CwiseBinaryOp<your_pow_functor<Scalar>, ExpressionType,
OtherDerived>(m_matrix, exponent.derived());
}
that's it!
gael
On Fri, Jan 22, 2010 at 7:42 PM, Thomas Capricelli
<orzel@xxxxxxxxxxxxxxx> wrote:
>
> I think eigen does not have this yet.... There's a method to use pow() on each item, but with the same exponent for all. I guess what you want would not be hard to add, though i'm not able to do it :/
>
> ++
> Thomas
> --
> Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
> http://www.freehackers.org/thomas
>
> On Friday 22 January 2010 17:37:37 Stefan Ulbrich wrote:
>> Hello,
>>
>> I could nout find a way to express matrixa.pow(matrixb) in Eigen2. Can anybody please give me an advise on how to extend the Cwise class by means of the CWISE_PLUGIN?
>> I have problems to distinguish which return types I have to use.
>>
>> Thank you a lot in advance,
>>
>> Stefan
>>
>>
>>
>>
>
>
>