Re: [eigen] Calculation of weighted norm |

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

*To*: <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: [eigen] Calculation of weighted norm*From*: "Claas H. Köhler" <claas.koehler@xxxxxx>*Date*: Mon, 2 Apr 2012 12:22:55 +0200*Organization*: Deutsches Zentrum für Luft-und Raumfahrt

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

**References**:**[eigen] Calculation of weighted norm***From:*Claas H. Koehler

**Re: [eigen] Calculation of weighted norm***From:*Christoph Hertzberg

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Calculation of weighted norm** - Next by Date:
**[eigen] NoChange_t, Sequential_t, etc.** - Previous by thread:
**Re: [eigen] Calculation of weighted norm** - Next by thread:
**[eigen] NoChange_t, Sequential_t, etc.**

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