CMS 3D CMS Logo

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

Typedef Documentation

◆ ALIMatrix

Definition at line 78 of file MatrixMeschach.h.

Function Documentation

◆ MatrixByMatrix()

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

Definition at line 345 of file MatrixMeschach.cc.

345  {
346  MatrixMeschach* matout = new MatrixMeschach(mat1);
347  if (matout->NoColumns() != mat2.NoLines()) {
348  std::cerr << " !! Trying two multiply two matrices when the number of columns of first one is not equal to number "
349  "of files of second one "
350  << std::endl;
351  // std::cout << " multiplying matrix " << matout->NoLines() << " x " << matout->NoColumns() << " and " << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << matout->NoLines() << " x " << mat2.NoColumns() << std::endl;
352  }
353  matout->setNoColumns(mat2.NoColumns());
354 
355  MAT* tempmat = m_get(matout->NoColumns(), matout->NoLines());
356  m_transp(matout->MatNonConst(), tempmat);
357  //M_FREE( _Mat );
358  matout->setMat(m_get(matout->NoLines(), mat2.NoColumns()));
359  mtrm_mlt(tempmat, mat2.MatNonConst(), matout->MatNonConst());
360 
361  /* if(ALIUtils::debug >= 9) std::cout << "add" << matout->NoLines() << matout->NoColumns()
362  << mat2.NoLines() << mat2.NoColumns()
363  << matout->NoLines() << matout->NoColumns() << std::endl;
364  if(ALIUtils::debug >= 9) std::cout << "addM" << matout->Mat()->m << matout->Mat()->n
365  << mat2.Mat()->m << mat2.Mat()->n
366  << matout->Mat()->m << matout->Mat()->n << std::endl;
367  */
368  // return MatrixMeschach( matout );
369  return (matout);
370 }

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

Referenced by Fit::GetSChi2().

◆ operator*() [1/3]

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

Definition at line 175 of file MatrixMeschach.cc.

175  {
176  MatrixMeschach matout(mat);
177  matout *= doub;
178  return matout;
179 }

◆ operator*() [2/3]

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

Definition at line 182 of file MatrixMeschach.cc.

182 { return doub * mat; }

◆ operator*() [3/3]

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

Definition at line 117 of file MatrixMeschach.cc.

117  {
118  MatrixMeschach mat1copy = mat1;
119  if (mat1copy.NoColumns() != mat2.NoLines()) {
120  std::cerr << " !! Trying two multiply two matrices when the number of columns of first one is not equal to number "
121  "of files of second one "
122  << std::endl;
123  std::cout << " multiplying matrix " << mat1copy.NoLines() << " x " << mat1copy.NoColumns() << " and "
124  << mat2.NoLines() << " x " << mat2.NoColumns() << " results in " << mat1copy.NoLines() << " x "
125  << mat2.NoColumns() << std::endl;
126  }
127  mat1copy.setNoColumns(mat2.NoColumns());
128 
129  MAT* tempmat = m_get(mat1copy.NoColumns(), mat1copy.NoLines());
130  m_transp(mat1copy.MatNonConst(), tempmat);
131 
132  //M_FREE( _Mat );
133  mat1copy.setMat(m_get(mat1copy.NoLines(), mat2.NoColumns()));
134  mtrm_mlt(tempmat, mat2.MatNonConst(), mat1copy.MatNonConst());
135 
136  free(tempmat);
137 
138  return mat1copy;
139 
140  MatrixMeschach* matout = new MatrixMeschach(mat1copy);
141 
142  /* if(ALIUtils::debug >= 9) std::cout << "add" << mat1copy.NoLines() << mat1copy.NoColumns()
143  << mat2.NoLines() << mat2.NoColumns()
144  << matout.NoLines() << matout.NoColumns() << std::endl;
145  if(ALIUtils::debug >= 9) std::cout << "addM" << mat1copy.Mat()->m << mat1copy.Mat()->n
146  << mat2.Mat()->m << mat2.Mat()->n
147  << matout.Mat()->m << matout.Mat()->n << std::endl;
148  */
149  // return MatrixMeschach( matout );
150  return (*matout);
151 }

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

◆ operator+()

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

Definition at line 154 of file MatrixMeschach.cc.

154  {
155  MatrixMeschach matout(mat1);
156  matout += mat2;
157  if (ALIUtils::debug >= 9)
158  std::cout << "add" << mat1.NoLines() << mat1.NoColumns() << mat2.NoLines() << mat2.NoColumns() << matout.NoLines()
159  << matout.NoColumns() << std::endl;
160  if (ALIUtils::debug >= 9)
161  std::cout << "addM" << mat1.Mat()->m << mat1.Mat()->n << mat2.Mat()->m << mat2.Mat()->n << matout.Mat()->m
162  << matout.Mat()->n << std::endl;
163  return MatrixMeschach(matout);
164 }

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

◆ operator-()

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

Definition at line 167 of file MatrixMeschach.cc.

167  {
168  MatrixMeschach matout(mat1);
169  const MatrixMeschach& matout2(mat2);
170  matout += (-1 * matout2);
171  return MatrixMeschach(matout);
172 }
MatrixMeschach::setNoColumns
void setNoColumns(ALIint ncol)
Definition: MatrixMeschach.h:55
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MatrixMeschach::NoLines
ALIint NoLines() const
Definition: MatrixMeschach.h:53
MatrixMeschach::Mat
const MAT * Mat() const
Definition: MatrixMeschach.h:57
MatrixMeschach::NoColumns
ALIint NoColumns() const
Definition: MatrixMeschach.h:54
ALIUtils::debug
static ALIint debug
Definition: ALIUtils.h:34
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
MatrixMeschach::setMat
void setMat(MAT *mat)
Definition: MatrixMeschach.h:58
MatrixMeschach
Definition: MatrixMeschach.h:30
MatrixMeschach::MatNonConst
MAT * MatNonConst() const
Definition: MatrixMeschach.h:59