19#include "CLHEP/Matrix/Matrix.h"
20#include "CLHEP/Matrix/SymMatrix.h"
29 S (i,j) = (10.0*i+j)/10;
38 std::cout<<
"SS.invert failed!!!! N = " << N <<
39 " ierr = "<< ierr <<std::endl;
51 if (fabs(SI(i,j)) > 1.0e-6) {
52 std::cout<<
"SS.invert incorrect N = " << N <<
53 " error = "<< fabs(SI(i,j)) <<std::endl;
58 if (fabs(1-SI(i,j)) > 1.0e-6) {
59 std::cout<<
"SS.invert incorrect N = " << N <<
60 " error = "<< fabs(1-SI(i,j)) <<std::endl;
74 if (fabs((detS-1.0/detSS)/detS) > 1.0e-6) {
75 std::cout<<
"Determinant incorrect N = " << N <<
76 " error = " << fabs((detS-1.0/detSS)/detS) <<std::endl;
86 double * &hMalloc80000 ) {
88 hMalloc = (
double*) malloc(
sizeof(
double));
89 hNew10000 =
new double[10000];
90 hMalloc80000 = (
double*) malloc(10000*
sizeof(
double));
102 double * &hMalloc80000,
105 double * &xhNew10000,
106 double * &xhMalloc80000 ) {
109 std::cout<<
"Leak:\n"
110 <<
"xhNew - hNew = " << xhNew - hNew <<
"\n";
113 if (hMalloc != xhMalloc) {
114 std::cout<<
"Leak:\n"
115 <<
"xhMalloc - hMalloc = " << xhMalloc - hMalloc <<
"\n";
118 if (hNew10000 != xhNew10000) {
119 std::cout<<
"Leak:\n"
120 <<
"xhNew10000 - hNew10000 = " << xhNew10000 - hNew10000 <<
"\n";
123 if (hMalloc80000 != xhMalloc80000) {
124 std::cout<<
"Leak:\n"
125 <<
"xhMalloc80000 - hMalloc80000 = " << xhMalloc80000 -hMalloc80000
136 for ( i = 1; i <= 50; i++) {
140 double *hNew, *hMalloc, *hNew10000, *hMalloc80000;
141 double *xhNew, *xhMalloc, *xhNew10000, *xhMalloc80000;
143 for (
int count=0; count < 2; ++count) {
148 for (i=0; i<n1; i++) {
149 for (j=1; j <= n2; j++) {
154 heapAddresses ( xhNew, xhMalloc, xhNew10000, xhMalloc80000 );
156 if(count != 0) rhp =
checkHeap ( hNew, hMalloc, hNew10000, hMalloc80000,
157 xhNew, xhMalloc, xhNew10000, xhMalloc80000 );
158 if (rhp) std::cout <<
"Above Leak is after " << n1*n2 <<
" test inversions\n";
162 for (i=0; i<2; i++) {
163 for (j=1; j < 20; j++) {
168 heapAddresses ( xhNew, xhMalloc, xhNew10000, xhMalloc80000 );
170 if(count != 0) rhp =
checkHeap ( hNew, hMalloc, hNew10000, hMalloc80000,
171 xhNew, xhMalloc, xhNew10000, xhMalloc80000 );
172 if (rhp) std::cout <<
"Leak after big inversions\n";
double determinant() const
int test_inversion(int N)
void heapAddresses(double *&hNew, double *&hMalloc, double *&hNew10000, double *&hMalloc80000)
int checkHeap(double *&hNew, double *&hMalloc, double *&hNew10000, double *&hMalloc80000, double *&xhNew, double *&xhMalloc, double *&xhNew10000, double *&xhMalloc80000)