ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LaOuterProduct.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/LaOuterProduct.h"
11 #include "Minuit2/LAVector.h"
12 #include "Minuit2/LASymMatrix.h"
13 
14 namespace ROOT {
15 
16  namespace Minuit2 {
17 
18 
19 int mndspr(const char*, unsigned int, double, const double*, int, double*);
20 
21 LASymMatrix::LASymMatrix(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>, double>& out) : fSize(0), fNRow(0), fData(0) {
22  // constructor from expression based on outer product of symmetric matrices
23  // std::cout<<"LASymMatrix::LASymMatrix(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>, double>& out)"<<std::endl;
24  fNRow = out.Obj().Obj().Obj().size();
25  fSize = fNRow*(fNRow+1)/2;
26  fData = (double*)StackAllocatorHolder::Get().Allocate(sizeof(double)*fSize);
27  memset(fData, 0, fSize*sizeof(double));
28  Outer_prod(*this, out.Obj().Obj().Obj(), out.f()*out.Obj().Obj().f()*out.Obj().Obj().f());
29 }
30 
32  // assignment operator from expression based on outer product of symmetric matrices
33  // std::cout<<"LASymMatrix& LASymMatrix::operator=(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>, double>& out)"<<std::endl;
34  if(fSize == 0 && fData == 0) {
35  fNRow = out.Obj().Obj().Obj().size();
36  fSize = fNRow*(fNRow+1)/2;
37  fData = (double*)StackAllocatorHolder::Get().Allocate(sizeof(double)*fSize);
38  memset(fData, 0, fSize*sizeof(double));
39  Outer_prod(*this, out.Obj().Obj().Obj(), out.f()*out.Obj().Obj().f()*out.Obj().Obj().f());
40  } else {
41  LASymMatrix tmp(out.Obj().Obj().Obj().size());
42  Outer_prod(tmp, out.Obj().Obj().Obj());
43  tmp *= double(out.f()*out.Obj().Obj().f()*out.Obj().Obj().f());
44  assert(fSize == tmp.size());
45  memcpy(fData, tmp.Data(), fSize*sizeof(double));
46  }
47  return *this;
48 }
49 
50 void Outer_prod(LASymMatrix& A, const LAVector& v, double f) {
51  // function performing outer product using mndspr (DSPR) routine from BLAS
52  mndspr("U", v.size(), f, v.Data(), 1, A.Data());
53 }
54 
55  } // namespace Minuit2
56 
57 } // namespace ROOT
unsigned int size() const
Definition: LAVector.h:198
#define assert(cond)
Definition: unittest.h:542
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
static double A[]
TFile * f
void Outer_prod(LASymMatrix &, const LAVector &, double f=1.)
void * Allocate(size_t nBytes)
int mndspr(const char *, unsigned int, double, const double *, int, double *)
Definition: mndspr.cxx:23
char * out
Definition: TBase64.cxx:29
SVector< double, 2 > v
Definition: Dict.h:5
LASymMatrix & operator=(const LASymMatrix &v)
Definition: LASymMatrix.h:81
const double * Data() const
Definition: LAVector.h:194
const double * Data() const
Definition: LASymMatrix.h:233
static StackAllocator & Get()