Creat a positive definite matrix, which way is better?

Hi everyone,
Suppose I have a positive definite matrix P and a non-singular matrix A, I realised there is a small numerical difference between K=(I-A)*P*(I-A)' and K_=P-A*P-P*A'+A*P*A'. If I want to create a positive definite matrix, which way should I use?
In some extreme cases, is it possible that K or K_ has very small negative eigenvalues?
Thanks

 Réponse acceptée

Matt J
Matt J le 12 Jan 2016
Modifié(e) : Matt J le 12 Jan 2016

0 votes

Yes, if A has eigenvalues close to 1, then I believe neither K nor K_ will be positive definite with numerical robustness.

4 commentaires

Ming
Ming le 12 Jan 2016
Thank you for your reply, is there any particular reason that K is better? From numerical robustness point of view, is K also better than K_?
Matt J
Matt J le 12 Jan 2016
Modifié(e) : Matt J le 12 Jan 2016
I think that will depend on A. Generally speaking though, addition of large numbers with opposite sign (plus/minus) is a numerical hazard. So, I would want to minimize the number of additions/subtractions in the implementation and keep the additive terms as small as I can. Thus, K seems preferable to me over K_.
Here's a simpler example along the same lines. In ideal arithmetic, both res1 and res2 should be zero. Numerically however, res2, which expands the calculation into more terms and with bigger magnitudes, gives the poorer result.
a=1e5*pi;
b=a+1;
res1 = (a-b)^2 -1,
res2 = a^2+b^2-2*a*b-1
This gives
res1 =
0
res2 =
3.0518e-05
Ming
Ming le 12 Jan 2016
Thanks a lot! By the way, does this numerical problem/hazard have a formal name?
No, not that I know of.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by