Re: [eigen] matrix-matrix pow()

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


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
>>
>>
>>
>>
>
>
>



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