# Is lapack getri numerically the same as getrs with identity matrix as RHS?

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)

• As usual, the most important question is whether you need the inverse or not. – percusse Nov 18 '16 at 13:47
• Have you tried it? Are the results exactly equal floating point numbers? – Federico Poloni Nov 19 '16 at 16:32
• @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. – lorniper Nov 19 '16 at 19:50

Basically I LAPACK documentation it states for getri
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.