// testBug7328.cc // // The bug reported a memory leak in inverting symmetric matrices (of size // greater than 6x6). // // This test verifies that the leak is no longer present, and checks for // correctness. There is a break in method at N=25, so both sides are examined. // // A similar (though unreported) leak was present in the Determinant method; // since this was also fixed, this test tests for correctness of determinant as // well. // #include //#include #include #include #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/SymMatrix.h" int test_inversion (int N) { int i,j; CLHEP::HepSymMatrix S(N,0); for(i=1;i<=N;++i) { for(j=1;j<=N;++j) { if(i<=j) { S (i,j) = (10.0*i+j)/10; } } } CLHEP::HepSymMatrix SS(N,0); SS = S; int ierr = 0; SS.invert(ierr); if (ierr) { std::cout<<"SS.invert failed!!!! N = " << N << " ierr = "<< ierr < 1.0e-6) { std::cout<<"SS.invert incorrect N = " << N << " error = "<< fabs(SI(i,j)) < 1.0e-6) { std::cout<<"SS.invert incorrect N = " << N << " error = "<< fabs(1-SI(i,j)) < 1.0e-6) { std::cout<<"Determinant incorrect N = " << N << " error = " << fabs((detS-1.0/detSS)/detS) <