Changeset 1511 for trunk/MagicSoft/Mars/mhist/MHMatrix.cc
- Timestamp:
- 09/02/02 15:58:52 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1500 r1511 49 49 50 50 #include <TList.h> 51 #include <TArrayF.h> 51 52 #include <TArrayD.h> 52 53 #include <TArrayI.h> … … 482 483 out << " " << GetUniqueName() << ".AddColumn(\"" << (*fData)[i].GetRule() << "\");" << endl; 483 484 } 485 486 const TArrayI MHMatrix::GetIndexOfSortedColumn(Int_t ncol, Bool_t desc) const 487 { 488 TMatrixColumn col(fM, ncol); 489 490 const Int_t n = fM.GetNrows(); 491 492 TArrayF array(n); 493 494 for (int i=0; i<n; i++) 495 array[i] = col(i); 496 497 TArrayI idx(n); 498 TMath::Sort(n, array.GetArray(), idx.GetArray(), desc); 499 500 return idx; 501 } 502 503 void MHMatrix::SortMatrixByColumn(Int_t ncol, Bool_t desc) 504 { 505 TArrayI idx = GetIndexOfSortedColumn(ncol, desc); 506 507 const Int_t n = fM.GetNrows(); 508 509 TMatrix m(n, fM.GetNcols()); 510 for (int i=0; i<n; i++) 511 { 512 TVector vold(n); 513 vold = TMatrixRow(fM, idx[i]); 514 515 TMatrixRow rownew(m, i); 516 rownew = vold; 517 } 518 519 fM = m; 520 }
Note:
See TracChangeset
for help on using the changeset viewer.