1
$\begingroup$

I was just wondering, in case of computing B=inv(A), suppose I is the identity matrix (diagonal),

After obtaining the factorization A_factorization by computing getrf(A), is it numerically the same to do the following solving steps?

getrs(A_factorization, piv, I)
getri(A_factorization, piv)
$\endgroup$
3
  • $\begingroup$ As usual, the most important question is whether you need the inverse or not. $\endgroup$
    – percusse
    Nov 18 '16 at 13:47
  • $\begingroup$ Have you tried it? Are the results exactly equal floating point numbers? $\endgroup$ Nov 19 '16 at 16:32
  • $\begingroup$ @FedericoPoloni In my calculation they give the same result, but I guess it's not true in general, that's the reason I ask this question, hopefully someone will clarify the theory behind it. $\endgroup$
    – lorniper
    Nov 19 '16 at 19:50
1
$\begingroup$

Basically I LAPACK documentation it states for getri

This method inverts U and then computes inv(A) by solving the system inv(A)*L = inv(U) for inv(A).

It seems that numerically is a different procedure than solving L*inv(L)=I and then U*inv(A)=inv(L). My understanding is that getri should be faster than getrs. Otherwise it would be no reason of creating this, except maybe of saving some memory work space.

Of course result is same in both cases.

$\endgroup$
2
  • 2
    $\begingroup$ "Of course result is same in both cases," Why is that true, given that calculations are performed in double precision, not infinite precision? $\endgroup$ Nov 19 '16 at 8:02
  • $\begingroup$ @MarkL.Stone you have a point, maybe "acceptable" would be better. But my feeling is that it might be misleading $\endgroup$
    – ztik
    Nov 21 '16 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.