Logo ROOT  
Reference Guide
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 int mndspr(const char *, unsigned int, double, const double *, int, double *);
19 
21  : fSize(0), fNRow(0), fData(0)
22 {
23  // constructor from expression based on outer product of symmetric matrices
24  // std::cout<<"LASymMatrix::LASymMatrix(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>,
25  // double>& out)"<<std::endl;
26  fNRow = out.Obj().Obj().Obj().size();
27  fSize = fNRow * (fNRow + 1) / 2;
28  fData = (double *)StackAllocatorHolder::Get().Allocate(sizeof(double) * fSize);
29  memset(fData, 0, fSize * sizeof(double));
30  Outer_prod(*this, out.Obj().Obj().Obj(), out.f() * out.Obj().Obj().f() * out.Obj().Obj().f());
31 }
32 
35 {
36  // assignment operator from expression based on outer product of symmetric matrices
37  // std::cout<<"LASymMatrix& LASymMatrix::operator=(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector,
38  // double>, double>, double>& out)"<<std::endl;
39  if (fSize == 0 && fData == 0) {
40  fNRow = out.Obj().Obj().Obj().size();
41  fSize = fNRow * (fNRow + 1) / 2;
42  fData = (double *)StackAllocatorHolder::Get().Allocate(sizeof(double) * fSize);
43  memset(fData, 0, fSize * sizeof(double));
44  Outer_prod(*this, out.Obj().Obj().Obj(), out.f() * out.Obj().Obj().f() * out.Obj().Obj().f());
45  } else {
46  LASymMatrix tmp(out.Obj().Obj().Obj().size());
47  Outer_prod(tmp, out.Obj().Obj().Obj());
48  tmp *= double(out.f() * out.Obj().Obj().f() * out.Obj().Obj().f());
49  assert(fSize == tmp.size());
50  memcpy(fData, tmp.Data(), fSize * sizeof(double));
51  }
52  return *this;
53 }
54 
55 void Outer_prod(LASymMatrix &A, const LAVector &v, double f)
56 {
57  // function performing outer product using mndspr (DSPR) routine from BLAS
58  mndspr("U", v.size(), f, v.Data(), 1, A.Data());
59 }
60 
61 } // namespace Minuit2
62 
63 } // namespace ROOT
ROOT::Minuit2::LASymMatrix::Data
const double * Data() const
Definition: LASymMatrix.h:268
f
#define f(i)
Definition: RSha256.hxx:104
LASymMatrix.h
ROOT::Minuit2::LAVector
Definition: LAVector.h:32
ROOT::Minuit2::LASymMatrix::LASymMatrix
LASymMatrix()
Definition: LASymMatrix.h:48
ROOT::Minuit2::LASymMatrix::operator=
LASymMatrix & operator=(const LASymMatrix &v)
Definition: LASymMatrix.h:80
ROOT::Minuit2::ABObj
Definition: ABObj.h:20
ROOT::Minuit2::LASymMatrix
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:45
ROOT::Minuit2::LASymMatrix::size
unsigned int size() const
Definition: LASymMatrix.h:272
ROOT::Math::Cephes::A
static double A[]
Definition: SpecFuncCephes.cxx:170
ROOT::Minuit2::Outer_prod
void Outer_prod(LASymMatrix &, const LAVector &, double f=1.)
Definition: LaOuterProduct.cxx:55
v
@ v
Definition: rootcling_impl.cxx:3664
ROOT::Minuit2::ABObj< vec, LAVector, double >
Definition: ABObj.h:66
ROOT::Minuit2::VectorOuterProduct
Definition: VectorOuterProduct.h:21
ROOT::Minuit2::mndspr
int mndspr(const char *, unsigned int, double, const double *, int, double *)
Definition: mndspr.cxx:22
ROOT::Minuit2::LASymMatrix::fData
double * fData
Definition: LASymMatrix.h:281
ROOT::Minuit2::LASymMatrix::fNRow
unsigned int fNRow
Definition: LASymMatrix.h:280
double
double
Definition: Converters.cxx:921
LAVector.h
ROOT::Minuit2::StackAllocator::Allocate
void * Allocate(size_t nBytes)
Definition: StackAllocator.h:71
ROOT::Minuit2::StackAllocatorHolder::Get
static StackAllocator & Get()
Definition: StackAllocator.h:223
ROOT::Minuit2::sym
Definition: ABTypes.h:19
LaOuterProduct.h
fSize
size_t fSize
Definition: DeclareConverters.h:342
ROOT::Minuit2::LASymMatrix::fSize
unsigned int fSize
Definition: LASymMatrix.h:279
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4