CMS 3D CMS Logo

Functions
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 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)
 

Function Documentation

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

Definition at line 396 of file MatrixMeschach.cc.

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

Referenced by Fit::GetSChi2().

397 {
398  MatrixMeschach* matout = new MatrixMeschach( mat1 );
399  if( matout->NoColumns() != mat2.NoLines() ){
400  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;
401  // std::cout << " multiplying matrix " << matout->NoLines() << " x " << matout->NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << matout->NoLines() << " x " << mat2.NoColumns() << std::endl;
402  }
403  matout->setNoColumns( mat2.NoColumns() );
404 
405  MAT* tempmat = m_get( matout->NoColumns(), matout->NoLines() );
406  m_transp( matout->MatNonConst(), tempmat);
407  //M_FREE( _Mat );
408  matout->setMat( m_get( matout->NoLines(), mat2.NoColumns() ) );
409  mtrm_mlt( tempmat, mat2.MatNonConst(), matout->MatNonConst());
410 
411 
412  /* if(ALIUtils::debug >= 9) std::cout << "add" << matout->NoLines() << matout->NoColumns()
413  << mat2.NoLines() << mat2.NoColumns()
414  << matout->NoLines() << matout->NoColumns() << std::endl;
415  if(ALIUtils::debug >= 9) std::cout << "addM" << matout->Mat()->m << matout->Mat()->n
416  << mat2.Mat()->m << mat2.Mat()->n
417  << matout->Mat()->m << matout->Mat()->n << std::endl;
418  */
419  // return MatrixMeschach( matout );
420  return ( matout );
421 
422 }
ALIint NoLines() const
ALIint NoColumns() const
MAT * MatNonConst() const
void setNoColumns(ALIint ncol)
void setMat(MAT *mat)
MatrixMeschach operator* ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 133 of file MatrixMeschach.cc.

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

Referenced by mathSSE::as3D().

134 {
135  MatrixMeschach mat1copy = mat1;
136  if( mat1copy.NoColumns() != mat2.NoLines() ){
137  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;
138  std::cout << " multiplying matrix " << mat1copy.NoLines() << " x " << mat1copy.NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << mat1copy.NoLines() << " x " << mat2.NoColumns() << std::endl;
139  }
140  mat1copy.setNoColumns( mat2.NoColumns() );
141 
142  MAT* tempmat = m_get( mat1copy.NoColumns(), mat1copy.NoLines() );
143  m_transp( mat1copy.MatNonConst(), tempmat);
144 
145  //M_FREE( _Mat );
146  mat1copy.setMat( m_get( mat1copy.NoLines(), mat2.NoColumns() ) );
147  mtrm_mlt( tempmat, mat2.MatNonConst(), mat1copy.MatNonConst());
148 
149  free(tempmat);
150 
151  return mat1copy;
152 
153 
154  MatrixMeschach* matout = new MatrixMeschach( mat1copy );
155 
156  /* if(ALIUtils::debug >= 9) std::cout << "add" << mat1copy.NoLines() << mat1copy.NoColumns()
157  << mat2.NoLines() << mat2.NoColumns()
158  << matout.NoLines() << matout.NoColumns() << std::endl;
159  if(ALIUtils::debug >= 9) std::cout << "addM" << mat1copy.Mat()->m << mat1copy.Mat()->n
160  << mat2.Mat()->m << mat2.Mat()->n
161  << matout.Mat()->m << matout.Mat()->n << std::endl;
162  */
163  // return MatrixMeschach( matout );
164  return ( *matout );
165 
166 }
ALIint NoLines() const
ALIint NoColumns() const
MAT * MatNonConst() const
void setNoColumns(ALIint ncol)
void setMat(MAT *mat)
MatrixMeschach operator* ( const ALIdouble  doub,
const MatrixMeschach mat 
)

Definition at line 196 of file MatrixMeschach.cc.

197 {
198  MatrixMeschach matout( mat );
199  matout *= doub;
200  return matout;
201 }
MatrixMeschach operator* ( const MatrixMeschach mat,
const ALIdouble  doub 
)

Definition at line 205 of file MatrixMeschach.cc.

206 {
207  return doub*mat;
208 }
MatrixMeschach operator+ ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 170 of file MatrixMeschach.cc.

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

Referenced by mathSSE::as3D().

171 {
172  MatrixMeschach matout( mat1 );
173  matout += mat2;
174  if(ALIUtils::debug >= 9) std::cout << "add" << mat1.NoLines() << mat1.NoColumns()
175  << mat2.NoLines() << mat2.NoColumns()
176  << matout.NoLines() << matout.NoColumns() << std::endl;
177  if(ALIUtils::debug >= 9) std::cout << "addM" << mat1.Mat()->m << mat1.Mat()->n
178  << mat2.Mat()->m << mat2.Mat()->n
179  << matout.Mat()->m << matout.Mat()->n << std::endl;
180  return MatrixMeschach( matout );
181 
182 }
ALIint NoLines() const
static ALIint debug
Definition: ALIUtils.h:36
ALIint NoColumns() const
const MAT * Mat() const
MatrixMeschach operator- ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 186 of file MatrixMeschach.cc.

References MatrixMeschach::MatrixMeschach().

Referenced by mathSSE::as3D().

187 {
188  MatrixMeschach matout( mat1 );
189  const MatrixMeschach& matout2( mat2 );
190  matout += (-1 * matout2);
191  return MatrixMeschach( matout );
192 }