Error in <TDecompChol::Decompose()>: matrix not positive definite

Hi Experts,

I was trying to invert TMatrixD matricies with small elements. Initially it was giving the following error[*]

[*]
Error in TDecompLU::InvertLU: matrix is singular, 6 diag elements < tolerance of 2.2204e-16
Error in TDecompChol::Decompose(): matrix not positive definite

then I put a .IsValid() to check whether the inversion was successful and also set matrix tolerance value to 2.2e-10. There was no more the “InverLU” message but still it shows the “matrix not positive definite” message[**]. Could you please tell me how to take care of it ??

[**]
Error in TDecompChol::Decompose(): matrix not positive definite

cheers - Niladri

Hi Niladri,

Could you show some code. I am puzzled about usage and TMatrixD and
the apperance of TDecompChol .

Best Regards, Eddy

Hi Eddy,

Here is the snipped code attached.

TMatrixDSym cov(dim);
for (i = 0; i < dim; i++) {
for (j = 0; j < dim; j++) {
double errPar = readParam(iBin,TString::Format(“EffErr%d”,i+1), j);
//cout << cov.IsValid() << endl;
if (! cov.IsValid()) continue;
//cov(i,j) =
errPar;

  if (errPar <= 0){
    cov(i,j) = 2.2e-10 ;
  } else {
    cov(i,j) = errPar;
  }

}

}

cheers - Niladri

Hi Niladri,

Are you sure that you are filling your matrix symmetrically through this ReadParam
routine ?

I do not see a call to a matrix inversion routine !

Best Eddy

Hi Eddy,

I am saving the matrix elements in the EffPar file and then I’m reading the elements in this script …

cheers – Niladri

Hi Eddy,

Still I’m getting the same message “Error in TDecompChol::Decompose(): matrix not positive definite”. When I changed the #parameters to 15, it worked absolutely fine. But when I am giving the #parameters to be 20, then this message shows off. Please tell me how to get rid of this message.

best regards – Niladri

Hi Niladri,

You will have to post something with which this error can be reproduced,
preferably short. Up to now you did not show any code where the inversion
is being done.

-Eddy