- Timestamp:
- 11/06/02 16:40:41 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1579 r1582 45 45 #include "MHMatrix.h" 46 46 47 #include <math.h> // abs for Alphas48 #include <stdlib.h> // abs for some Linux machines49 50 47 #include <fstream.h> 51 48 … … 384 381 // represented by the covariance metrix m. 385 382 // - If n<0 the kernel method is applied and 386 // sum(epx(-d)/nis returned.387 // - For n> =0 the n nearest neighbors are summed and388 // sqrt(sum(d) )/nis returned.383 // -log(sum(epx(-d/h))/n) is returned. 384 // - For n>0 the n nearest neighbors are summed and 385 // sqrt(sum(d)/n) is returned. 389 386 // - if n==0 all distances are summed 390 387 // … … 395 392 TVector d = evt; 396 393 d *= m; 397 return sqrt(d*evt);394 return TMath::Sqrt(d*evt); 398 395 } 399 396 … … 430 427 TMath::Sort(dists.GetSize(), dists.GetArray(), idx.GetArray(), kFALSE); 431 428 432 const Int_t n = abs(num)<rows ? abs(num) : rows;429 const Int_t n = TMath::Abs(num)<rows ? TMath::Abs(num) : rows; 433 430 434 431 if (num<0) 435 432 { 436 433 // 437 // Kernel function sum 434 // Kernel function sum (window size h set according to literature) 438 435 // 439 const Double_t h = 1; 436 const Double_t h = TMath::Power(rows, -1./(cols+4)); 437 const Double_t hwin = h*h*2; 440 438 441 439 Double_t res = 0; 442 440 for (int i=0; i<n; i++) 443 res += exp(-dists[idx[i]]/h);444 445 return - log(res/n);441 res += TMath::Exp(-dists[idx[i]]/hwin); 442 443 return -TMath::Log(res/n); 446 444 } 447 445 else … … 454 452 res += dists[idx[i]]; 455 453 456 return sqrt(res/n);454 return TMath::Sqrt(res/n); 457 455 } 458 456 }
Note:
See TracChangeset
for help on using the changeset viewer.