LaEigenValues.cxx

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: LaEigenValues.cxx 20880 2007-11-19 11:23:41Z rdm $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #include "Minuit2/LAVector.h"
00011 #include "Minuit2/LASymMatrix.h"
00012 
00013 namespace ROOT {
00014 
00015    namespace Minuit2 {
00016 
00017 
00018 int mneigen(double*, unsigned int, unsigned int, unsigned int, double*,double);
00019 
00020 LAVector eigenvalues(const LASymMatrix& mat) {
00021    // calculate eigenvalues of symmetric matrices using mneigen function (transalte from fortran Minuit)
00022    unsigned int nrow = mat.Nrow();
00023    
00024    LAVector tmp(nrow*nrow);
00025    LAVector work(2*nrow);
00026    
00027    for(unsigned int i = 0; i < nrow; i++)
00028       for(unsigned int j = 0; j <= i; j++) {
00029          tmp(i + j*nrow) = mat(i,j);
00030          tmp(i*nrow + j) = mat(i,j);
00031       }
00032          
00033          int info = mneigen(tmp.Data(), nrow, nrow, work.size(), work.Data(), 1.e-6);
00034    
00035    assert(info == 0);
00036    
00037    LAVector result(nrow);
00038    for(unsigned int i = 0; i < nrow; i++) result(i) = work(i);
00039    
00040    return result;
00041 }
00042 
00043    }  // namespace Minuit2
00044 
00045 }  // namespace ROOT

Generated on Tue Jul 5 14:37:09 2011 for ROOT_528-00b_version by  doxygen 1.5.1