LaOuterProduct.cxx

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: LaOuterProduct.cxx 20880 2007-11-19 11:23:41Z rdm $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #include "Minuit2/LaOuterProduct.h"
00011 #include "Minuit2/LAVector.h"
00012 #include "Minuit2/LASymMatrix.h"
00013 
00014 namespace ROOT {
00015 
00016    namespace Minuit2 {
00017 
00018 
00019 int mndspr(const char*, unsigned int, double, const double*, int, double*);
00020 
00021 LASymMatrix::LASymMatrix(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>, double>& out) : fSize(0), fNRow(0), fData(0) {
00022    // constructor from expression based on outer product of symmetric matrices
00023    //   std::cout<<"LASymMatrix::LASymMatrix(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>, double>& out)"<<std::endl;
00024    fNRow = out.Obj().Obj().Obj().size();
00025    fSize = fNRow*(fNRow+1)/2;
00026    fData = (double*)StackAllocatorHolder::Get().Allocate(sizeof(double)*fSize);
00027    memset(fData, 0, fSize*sizeof(double));
00028    Outer_prod(*this, out.Obj().Obj().Obj(), out.f()*out.Obj().Obj().f()*out.Obj().Obj().f());
00029 }
00030 
00031 LASymMatrix& LASymMatrix::operator=(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>, double>& out) {
00032    // assignment operator from expression based on outer product of symmetric matrices   
00033    //   std::cout<<"LASymMatrix& LASymMatrix::operator=(const ABObj<sym, VectorOuterProduct<ABObj<vec, LAVector, double>, double>, double>& out)"<<std::endl;
00034    if(fSize == 0 && fData == 0) {
00035       fNRow = out.Obj().Obj().Obj().size();
00036       fSize = fNRow*(fNRow+1)/2;
00037       fData = (double*)StackAllocatorHolder::Get().Allocate(sizeof(double)*fSize);
00038       memset(fData, 0, fSize*sizeof(double));
00039       Outer_prod(*this, out.Obj().Obj().Obj(), out.f()*out.Obj().Obj().f()*out.Obj().Obj().f());
00040    } else {
00041       LASymMatrix tmp(out.Obj().Obj().Obj().size());
00042       Outer_prod(tmp, out.Obj().Obj().Obj());
00043       tmp *= double(out.f()*out.Obj().Obj().f()*out.Obj().Obj().f());
00044       assert(fSize == tmp.size());
00045       memcpy(fData, tmp.Data(), fSize*sizeof(double));
00046    }
00047    return *this;
00048 }
00049 
00050 void Outer_prod(LASymMatrix& A, const LAVector& v, double f) {
00051    // function performing outer product using mndspr (DSPR) routine from BLAS
00052    mndspr("U", v.size(), f, v.Data(), 1, A.Data());
00053 }
00054 
00055    }  // namespace Minuit2
00056 
00057 }  // namespace ROOT

Generated on Tue Jul 5 14:37:09 2011 for ROOT_528-00b_version by  doxygen 1.5.1