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
16namespace Minuit2 {
17
18int 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
55void 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
size_t fSize
#define f(i)
Definition: RSha256.hxx:104
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:45
const double * Data() const
Definition: LASymMatrix.h:268
LASymMatrix & operator=(const LASymMatrix &v)
Definition: LASymMatrix.h:80
unsigned int size() const
Definition: LASymMatrix.h:272
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:22
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.