Logo ROOT   6.21/01
Reference Guide
LaEigenValues.cxx
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #include "Minuit2/LAVector.h"
11 #include "Minuit2/LASymMatrix.h"
12 
13 namespace ROOT {
14 
15  namespace Minuit2 {
16 
17 
18 int mneigen(double*, unsigned int, unsigned int, unsigned int, double*,double);
19 
21  // calculate eigenvalues of symmetric matrices using mneigen function (transalte from fortran Minuit)
22  unsigned int nrow = mat.Nrow();
23 
24  LAVector tmp(nrow*nrow);
25  LAVector work(2*nrow);
26 
27  for(unsigned int i = 0; i < nrow; i++)
28  for(unsigned int j = 0; j <= i; j++) {
29  tmp(i + j*nrow) = mat(i,j);
30  tmp(i*nrow + j) = mat(i,j);
31  }
32 
33  int info = mneigen(tmp.Data(), nrow, nrow, work.size(), work.Data(), 1.e-6);
34  (void)info;
35  assert(info == 0);
36 
37  LAVector result(nrow);
38  for(unsigned int i = 0; i < nrow; i++) result(i) = work(i);
39 
40  return result;
41 }
42 
43  } // namespace Minuit2
44 
45 } // namespace ROOT
Returns the available number of logical cores.
Definition: StringConv.hxx:21
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
int mneigen(double *, unsigned int, unsigned int, unsigned int, double *, double)
Definition: mnteigen.cxx:22
unsigned int Nrow() const
Definition: LASymMatrix.h:239
unsigned int size() const
Definition: LAVector.h:198
typedef void((*Func_t)())
const double * Data() const
Definition: LAVector.h:194
LAVector eigenvalues(const LASymMatrix &mat)