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
11#include "Minuit2/LAVector.h"
12#include "Minuit2/LASymMatrix.h"
13
14namespace ROOT {
15
16 namespace Minuit2 {
17
18
19int mndspr(const char*, unsigned int, double, const double*, int, double*);
20
21LASymMatrix::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
50void 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
double
Definition: Converters.cxx:921
size_t fSize
#define f(i)
Definition: RSha256.hxx:104
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
const double * Data() const
Definition: LASymMatrix.h:233
LASymMatrix & operator=(const LASymMatrix &v)
Definition: LASymMatrix.h:81
unsigned int size() const
Definition: LASymMatrix.h:237
static StackAllocator & Get()
void * Allocate(size_t nBytes)
static double A[]
void Outer_prod(LASymMatrix &, const LAVector &, double f=1.)
int mndspr(const char *, unsigned int, double, const double *, int, double *)
Definition: mndspr.cxx:23
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21