Logo ROOT  
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
13namespace ROOT {
14
15 namespace Minuit2 {
16
17
18int 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
typedef void((*Func_t)())
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
unsigned int Nrow() const
Definition: LASymMatrix.h:239
const double * Data() const
Definition: LAVector.h:194
unsigned int size() const
Definition: LAVector.h:198
LAVector eigenvalues(const LASymMatrix &mat)
int mneigen(double *, unsigned int, unsigned int, unsigned int, double *, double)
Definition: mnteigen.cxx:22
VSD Structures.
Definition: StringConv.hxx:21