CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Functions
MatrixMeschach.h File Reference
#include "Alignment/CocoaUtilities/interface/CocoaGlobals.h"
#include <vector>
#include <iostream>
#include <matrix.h>
#include <matrix2.h>

Go to the source code of this file.

Classes

class  MatrixMeschach
 

Typedefs

typedef MatrixMeschach ALIMatrix
 

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)
 

Typedef Documentation

Definition at line 97 of file MatrixMeschach.h.

Function Documentation

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

Definition at line 401 of file MatrixMeschach.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, MatrixMeschach::MatNonConst(), MatrixMeschach::NoColumns(), MatrixMeschach::NoLines(), MatrixMeschach::setMat(), and MatrixMeschach::setNoColumns().

Referenced by Fit::GetSChi2().

402 {
403  MatrixMeschach* matout = new MatrixMeschach( mat1 );
404  if( matout->NoColumns() != mat2.NoLines() ){
405  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;
406  // std::cout << " multiplying matrix " << matout->NoLines() << " x " << matout->NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << matout->NoLines() << " x " << mat2.NoColumns() << std::endl;
407  }
408  matout->setNoColumns( mat2.NoColumns() );
409 
410  MAT* tempmat = m_get( matout->NoColumns(), matout->NoLines() );
411  m_transp( matout->MatNonConst(), tempmat);
412  //M_FREE( _Mat );
413  matout->setMat( m_get( matout->NoLines(), mat2.NoColumns() ) );
414  mtrm_mlt( tempmat, mat2.MatNonConst(), matout->MatNonConst());
415 
416 
417  /* if(ALIUtils::debug >= 9) std::cout << "add" << matout->NoLines() << matout->NoColumns()
418  << mat2.NoLines() << mat2.NoColumns()
419  << matout->NoLines() << matout->NoColumns() << std::endl;
420  if(ALIUtils::debug >= 9) std::cout << "addM" << matout->Mat()->m << matout->Mat()->n
421  << mat2.Mat()->m << mat2.Mat()->n
422  << matout->Mat()->m << matout->Mat()->n << std::endl;
423  */
424  // return MatrixMeschach( matout );
425  return ( matout );
426 
427 }
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 138 of file MatrixMeschach.cc.

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

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

Definition at line 201 of file MatrixMeschach.cc.

202 {
203  MatrixMeschach matout( mat );
204  matout *= doub;
205  return matout;
206 }
MatrixMeschach operator* ( const MatrixMeschach mat,
const ALIdouble  doub 
)

Definition at line 210 of file MatrixMeschach.cc.

211 {
212  return doub*mat;
213 }
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().

176 {
177  MatrixMeschach matout( mat1 );
178  matout += mat2;
179  if(ALIUtils::debug >= 9) std::cout << "add" << mat1.NoLines() << mat1.NoColumns()
180  << mat2.NoLines() << mat2.NoColumns()
181  << matout.NoLines() << matout.NoColumns() << std::endl;
182  if(ALIUtils::debug >= 9) std::cout << "addM" << mat1.Mat()->m << mat1.Mat()->n
183  << mat2.Mat()->m << mat2.Mat()->n
184  << matout.Mat()->m << matout.Mat()->n << std::endl;
185  return MatrixMeschach( matout );
186 
187 }
ALIint NoLines() const
static ALIint debug
Definition: ALIUtils.h:35
ALIint NoColumns() const
const MAT * Mat() const
tuple cout
Definition: gather_cfg.py:121
MatrixMeschach operator- ( const MatrixMeschach mat1,
const MatrixMeschach mat2 
)

Definition at line 191 of file MatrixMeschach.cc.

192 {
193  MatrixMeschach matout( mat1 );
194  MatrixMeschach matout2( mat2 );
195  matout += (-1 * matout2);
196  return MatrixMeschach( matout );
197 }