Re: [eigen] Calculation of weighted norm

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



On 02/04/12 11:08, Christoph Hertzberg wrote:
> On 02.04.2012 10:14, Claas H. Koehler wrote:
>> Hi!
>>
>> I was wondering about the best way to calculate the weighted square norm of a complex vector, i.e.
>>
>> x^t A x
>>
>> where x is a complex vector and A is a real diagonal matrix. [...]
> 
> If A is a diagonal, this is equivalent to:
> 
> 	double norm2 = x.cwiseAbs2().cwiseProduct(A).sum();
> 
> assuming A is just the vector storing the diagonal entries.

Thank you, Christoph. I like this much better than my original solution.

Regards
Claas



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