# Propagation error of inverse matrix

Hello Rooters,
I want to calculate the propagation error of inverse matrix.
Is there a direct way to do it in root?
I found an equation related to propagation error of inverse matrix from a document(attcached the document)
Here is my equation

|\sigma_{\epsilon^-1}|{ij}^2= [\epsilon^{-1}]ik^2 * [\sigma{\epsilon}]{km}^2 *[\epsilon^{-1}]_mi^2
If this is not clear please see equation 10 in the following pdf.

Could someone please help me to work on the Matrix using root?

How can I code this?

I already have inverse matrix and sigma(error ) matrix.

Thanks
Dil

May be @moneta has an idea.

Thank You @ couet

According to the equation I need to get the square of each element.
I am stuck on how to code this.

Assume I have a matrix called matrix_GEN. This is 6x6 symmetric matrix.

TMatrixD matrix_GEN(6,6)

//I took the inverse of this matrix_GEN
TMatrixD matInv_GEN(matrix_GEN);
matInv_GEN.Invert();


Then what I need to do, I need to square each element of this matInv_GEN matrix.

How can I do this?

Thank You
Dil

It looks like Invert is in TMatrixT and in that case there is the operator Sqr. Again @moneta can cofirm.

Hello,
Thank you for the suggestion,
I think I solved this.Please see my following code part.

cout << "Matrix_GEN" << endl;
matrixGEN.Print(",matrixGEN");

TMatrixD matInv_GEN(matrixGEN);
matInv_GEN.Invert();
cout << "Matrix_GEN_Inverse" << endl;
matInv_GEN.Print("matInv_GEN");

TMatrixD matInv_GEN_square(6,6);

for(int i_Simu=0; i_Simu < 6; i_Simu++){
for(int j_Gen=0; j_Gen < 6; j_Gen++){

matInv_GEN_square[i_Simu][j_Gen]=matInv_GEN[i_Simu][j_Gen]* matInv_GEN[i_Simu][j_Gen];

}
}
cout << "Matrix_GEN_Inverse_Square" << endl;
matInv_GEN_square.Print();


1 Like

Hi Dil,

I guess this question is a rephrasing of this post.

Now it is clearer what you are looking for The error in the elements of the inverse matrix coming from uncertainties in the original matrix. This is an implementation of TMatrix operations following the recipes in the pdf file. It is a very specific choice for errors in the equations and not implemented in ROOT.

best regards, Eddy