CMS 3D CMS Logo

MatrixMeschach.cc File Reference

#include "Alignment/CocoaUtilities/interface/ALIUtils.h"
#include "Alignment/CocoaFit/interface/MatrixMeschach.h"
#include <iomanip>
#include <math.h>

Go to the source code of this file.

Functions

MatrixMeschachMatrixByMatrix (const MatrixMeschach &mat1, const MatrixMeschach &mat2)
MatrixMeschach operator * (const MatrixMeschach &mat, const ALIdouble doub)
MatrixMeschach operator * (const ALIdouble doub, const MatrixMeschach &mat)
MatrixMeschach operator * (const MatrixMeschach &mat1, const MatrixMeschach &mat2)
MatrixMeschach operator+ (const MatrixMeschach &mat1, const MatrixMeschach &mat2)
MatrixMeschach operator- (const MatrixMeschach &mat1, const MatrixMeschach &mat2)


Function Documentation

MatrixMeschach* MatrixByMatrix ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 394 of file MatrixMeschach.cc.

References TestMuL1L2Filter_cff::cerr, lat::endl(), MatrixMeschach::MatNonConst(), MatrixMeschach::MatrixMeschach(), MatrixMeschach::NoColumns(), MatrixMeschach::NoLines(), MatrixMeschach::setMat(), and MatrixMeschach::setNoColumns().

Referenced by Fit::GetSChi2().

00395 {
00396  MatrixMeschach* matout = new MatrixMeschach( mat1 );
00397   if( matout->NoColumns() != mat2.NoLines() ){
00398     std::cerr << " !! Trying two multiply two matrices when the number of columns of first one is not equal to number of files of second one " << std::endl;
00399     //    std::cout << " multiplying matrix " << matout->NoLines() << " x " << matout->NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << matout->NoLines() << " x " << mat2.NoColumns() << std::endl;
00400   }
00401   matout->setNoColumns( mat2.NoColumns() );
00402 
00403   MAT* tempmat = m_get( matout->NoColumns(), matout->NoLines() );
00404   m_transp( matout->MatNonConst(), tempmat); 
00405   //M_FREE( _Mat );
00406   matout->setMat( m_get( matout->NoLines(), mat2.NoColumns() ) );
00407   mtrm_mlt( tempmat, mat2.MatNonConst(), matout->MatNonConst());
00408 
00409 
00410   /*  if(ALIUtils::debug >= 9) std::cout << "add" << matout->NoLines() << matout->NoColumns()
00411        << mat2.NoLines() << mat2.NoColumns()  
00412        << matout->NoLines() << matout->NoColumns() << std::endl;
00413   if(ALIUtils::debug >= 9) std::cout << "addM" << matout->Mat()->m << matout->Mat()->n
00414                                      << mat2.Mat()->m << mat2.Mat()->n
00415        << matout->Mat()->m << matout->Mat()->n << std::endl;
00416   */
00417   //  return MatrixMeschach( matout );
00418   return ( matout );
00419 
00420 }

MatrixMeschach operator * ( const MatrixMeschach mat,
const ALIdouble  doub 
)

Definition at line 203 of file MatrixMeschach.cc.

00204 {
00205   return doub*mat;
00206 }

MatrixMeschach operator * ( const ALIdouble  doub,
const MatrixMeschach mat 
)

Definition at line 194 of file MatrixMeschach.cc.

00195 {
00196   MatrixMeschach matout( mat );
00197   matout *= doub;
00198   return matout;
00199 }

MatrixMeschach operator * ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 137 of file MatrixMeschach.cc.

References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), MatrixMeschach::MatNonConst(), MatrixMeschach::MatrixMeschach(), MatrixMeschach::NoColumns(), MatrixMeschach::NoLines(), MatrixMeschach::setMat(), and MatrixMeschach::setNoColumns().

Referenced by ITERATOR_BASE().

00138 {
00139   MatrixMeschach mat1copy = mat1;
00140   if( mat1copy.NoColumns() != mat2.NoLines() ){
00141     std::cerr << " !! Trying two multiply two matrices when the number of columns of first one is not equal to number of files of second one " << std::endl;
00142     std::cout << " multiplying matrix " << mat1copy.NoLines() << " x " << mat1copy.NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << mat1copy.NoLines() << " x " << mat2.NoColumns() << std::endl;
00143   }
00144   mat1copy.setNoColumns( mat2.NoColumns() );
00145 
00146   MAT* tempmat = m_get( mat1copy.NoColumns(), mat1copy.NoLines() );
00147   m_transp( mat1copy.MatNonConst(), tempmat); 
00148   //M_FREE( _Mat );
00149   mat1copy.setMat( m_get( mat1copy.NoLines(), mat2.NoColumns() ) );
00150   mtrm_mlt( tempmat, mat2.MatNonConst(), mat1copy.MatNonConst());
00151 
00152   MatrixMeschach* matout = new MatrixMeschach( mat1copy );
00153 
00154   /*  if(ALIUtils::debug >= 9) std::cout << "add" << mat1copy.NoLines() << mat1copy.NoColumns()
00155        << mat2.NoLines() << mat2.NoColumns()  
00156        << matout.NoLines() << matout.NoColumns() << std::endl;
00157   if(ALIUtils::debug >= 9) std::cout << "addM" << mat1copy.Mat()->m << mat1copy.Mat()->n
00158                                      << mat2.Mat()->m << mat2.Mat()->n
00159        << matout.Mat()->m << matout.Mat()->n << std::endl;
00160   */
00161   //  return MatrixMeschach( matout );
00162   return ( *matout );
00163 
00164 }

MatrixMeschach operator+ ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 168 of file MatrixMeschach.cc.

References GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, lat::endl(), MatrixMeschach::Mat(), MatrixMeschach::MatrixMeschach(), MatrixMeschach::NoColumns(), and MatrixMeschach::NoLines().

00169 {
00170   MatrixMeschach matout( mat1 );
00171   matout += mat2;
00172    if(ALIUtils::debug >= 9) std::cout << "add" << mat1.NoLines() << mat1.NoColumns()
00173        << mat2.NoLines() << mat2.NoColumns()  
00174        << matout.NoLines() << matout.NoColumns() << std::endl;
00175    if(ALIUtils::debug >= 9) std::cout << "addM" << mat1.Mat()->m << mat1.Mat()->n
00176        << mat2.Mat()->m << mat2.Mat()->n
00177        << matout.Mat()->m << matout.Mat()->n << std::endl;
00178   return MatrixMeschach( matout );
00179 
00180 }

MatrixMeschach operator- ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 184 of file MatrixMeschach.cc.

References MatrixMeschach::MatrixMeschach().

00185 {
00186   MatrixMeschach matout( mat1 );
00187   MatrixMeschach matout2( mat2 );
00188   matout += (-1 * matout2);
00189   return MatrixMeschach( matout );
00190 }


Generated on Tue Jun 9 17:50:33 2009 for CMSSW by  doxygen 1.5.4