CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/Alignment/CocoaFit/src/MatrixMeschach.cc File Reference

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

Go to the source code of this file.

Functions

MatrixMeschachMatrixByMatrix (const MatrixMeschach &mat1, const MatrixMeschach &mat2)
MatrixMeschach operator* (const ALIdouble doub, const MatrixMeschach &mat)
MatrixMeschach operator* (const MatrixMeschach &mat, const ALIdouble doub)
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 401 of file MatrixMeschach.cc.

References dtNoiseDBValidation_cfg::cerr, MatrixMeschach::MatNonConst(), MatrixMeschach::NoColumns(), MatrixMeschach::NoLines(), MatrixMeschach::setMat(), and MatrixMeschach::setNoColumns().

Referenced by Fit::GetSChi2().

{
 MatrixMeschach* matout = new MatrixMeschach( mat1 );
  if( matout->NoColumns() != mat2.NoLines() ){
    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;
    //    std::cout << " multiplying matrix " << matout->NoLines() << " x " << matout->NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << matout->NoLines() << " x " << mat2.NoColumns() << std::endl;
  }
  matout->setNoColumns( mat2.NoColumns() );

  MAT* tempmat = m_get( matout->NoColumns(), matout->NoLines() );
  m_transp( matout->MatNonConst(), tempmat); 
  //M_FREE( _Mat );
  matout->setMat( m_get( matout->NoLines(), mat2.NoColumns() ) );
  mtrm_mlt( tempmat, mat2.MatNonConst(), matout->MatNonConst());


  /*  if(ALIUtils::debug >= 9) std::cout << "add" << matout->NoLines() << matout->NoColumns()
       << mat2.NoLines() << mat2.NoColumns()  
       << matout->NoLines() << matout->NoColumns() << std::endl;
  if(ALIUtils::debug >= 9) std::cout << "addM" << matout->Mat()->m << matout->Mat()->n
                                     << mat2.Mat()->m << mat2.Mat()->n
       << matout->Mat()->m << matout->Mat()->n << std::endl;
  */
  //  return MatrixMeschach( matout );
  return ( matout );

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

Definition at line 201 of file MatrixMeschach.cc.

{
  MatrixMeschach matout( mat );
  matout *= doub;
  return matout;
}
MatrixMeschach operator* ( const MatrixMeschach mat,
const ALIdouble  doub 
)

Definition at line 210 of file MatrixMeschach.cc.

{
  return doub*mat;
}
MatrixMeschach operator* ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 138 of file MatrixMeschach.cc.

References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, MatrixMeschach::MatNonConst(), MatrixMeschach::NoColumns(), MatrixMeschach::NoLines(), MatrixMeschach::setMat(), and MatrixMeschach::setNoColumns().

{
  MatrixMeschach mat1copy = mat1;
  if( mat1copy.NoColumns() != mat2.NoLines() ){
    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;
    std::cout << " multiplying matrix " << mat1copy.NoLines() << " x " << mat1copy.NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << mat1copy.NoLines() << " x " << mat2.NoColumns() << std::endl;
  }
  mat1copy.setNoColumns( mat2.NoColumns() );

  MAT* tempmat = m_get( mat1copy.NoColumns(), mat1copy.NoLines() );
  m_transp( mat1copy.MatNonConst(), tempmat);
 
  //M_FREE( _Mat );
  mat1copy.setMat( m_get( mat1copy.NoLines(), mat2.NoColumns() ) );
  mtrm_mlt( tempmat, mat2.MatNonConst(), mat1copy.MatNonConst());

  free(tempmat);

  return mat1copy;


  MatrixMeschach* matout = new MatrixMeschach( mat1copy );

  /*  if(ALIUtils::debug >= 9) std::cout << "add" << mat1copy.NoLines() << mat1copy.NoColumns()
       << mat2.NoLines() << mat2.NoColumns()  
       << matout.NoLines() << matout.NoColumns() << std::endl;
  if(ALIUtils::debug >= 9) std::cout << "addM" << mat1copy.Mat()->m << mat1copy.Mat()->n
                                     << mat2.Mat()->m << mat2.Mat()->n
       << matout.Mat()->m << matout.Mat()->n << std::endl;
  */
  //  return MatrixMeschach( matout );
  return ( *matout );

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

Definition at line 175 of file MatrixMeschach.cc.

References gather_cfg::cout, ALIUtils::debug, MatrixMeschach::Mat(), MatrixMeschach::NoColumns(), and MatrixMeschach::NoLines().

{
  MatrixMeschach matout( mat1 );
  matout += mat2;
   if(ALIUtils::debug >= 9) std::cout << "add" << mat1.NoLines() << mat1.NoColumns()
       << mat2.NoLines() << mat2.NoColumns()  
       << matout.NoLines() << matout.NoColumns() << std::endl;
   if(ALIUtils::debug >= 9) std::cout << "addM" << mat1.Mat()->m << mat1.Mat()->n
       << mat2.Mat()->m << mat2.Mat()->n
       << matout.Mat()->m << matout.Mat()->n << std::endl;
  return MatrixMeschach( matout );

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

Definition at line 191 of file MatrixMeschach.cc.

{
  MatrixMeschach matout( mat1 );
  MatrixMeschach matout2( mat2 );
  matout += (-1 * matout2);
  return MatrixMeschach( matout );
}