Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:24

0001 //   COCOA class header file

0002 //Id:  MatrixMeschach.h

0003 //CAT: Model

0004 //

0005 //   Class for matrices

0006 //

0007 //   History: v1.0

0008 //   Pedro Arce

0009 
0010 #ifndef _ALIMATRIX_HH
0011 #define _ALIMATRIX_HH
0012 
0013 #include "Alignment/CocoaUtilities/interface/CocoaGlobals.h"
0014 #include <vector>
0015 #include <iostream>
0016 
0017 extern "C" {
0018 #include <matrix.h>
0019 #include <matrix2.h>
0020 }
0021 
0022 // Meschach external (matrix.h) defines C++-incompatible macros

0023 // which break other code (e.g. standard <limits>).

0024 // Since these are not used here, undef them.

0025 #undef max
0026 #undef min
0027 #undef catch
0028 #undef Real
0029 
0030 class MatrixMeschach {
0031 public:
0032   MatrixMeschach();
0033   MatrixMeschach(ALIint NoCol, ALIint NoLin);
0034   MatrixMeschach(const MatrixMeschach& mat);
0035   ~MatrixMeschach();
0036 
0037   void AddData(ALIuint col, ALIuint lin, ALIdouble data);
0038   void transpose();
0039   void inverse();
0040   void Dump(const ALIstring& mtext);
0041   void ostrDump(std::ostream& fout, const ALIstring& mtext);
0042   void EliminateLines(ALIint lin_first, ALIint lin_last);
0043   void EliminateColumns(ALIint lin_first, ALIint lin_last);
0044   void SetCorrelation(ALIint i1, ALIint i2, ALIdouble corr);
0045 
0046   MatrixMeschach& operator=(const MatrixMeschach& mat);
0047   void operator*=(const MatrixMeschach& mat);
0048   void operator+=(const MatrixMeschach& mat);
0049   void operator*=(const ALIdouble num);
0050   ALIdouble operator()(int i, int j) const;
0051 
0052   //ACCESS PRIVATE DATA MEMBERS

0053   ALIint NoLines() const { return _NoLines; }
0054   ALIint NoColumns() const { return _NoColumns; }
0055   void setNoColumns(ALIint ncol) { _NoColumns = ncol; }
0056   void setNoLines(ALIint nlin) { _NoLines = nlin; }
0057   const MAT* Mat() const { return _Mat; }
0058   void setMat(MAT* mat) { _Mat = mat; }
0059   MAT* MatNonConst() const { return _Mat; }
0060 
0061 private:
0062   // private data members

0063   ALIint _NoLines;
0064   ALIint _NoColumns;
0065   //  vector< ALIdouble> _data;

0066   MAT* _Mat;
0067 
0068   void copy(const MatrixMeschach& mat);
0069 };
0070 
0071 MatrixMeschach operator*(const MatrixMeschach& mat1, const MatrixMeschach& mat2);
0072 MatrixMeschach operator+(const MatrixMeschach& mat1, const MatrixMeschach& mat2);
0073 MatrixMeschach operator-(const MatrixMeschach& mat1, const MatrixMeschach& mat2);
0074 MatrixMeschach operator*(const ALIdouble doub, const MatrixMeschach& mat);
0075 MatrixMeschach operator*(const MatrixMeschach& mat, const ALIdouble doub);
0076 
0077 MatrixMeschach* MatrixByMatrix(const MatrixMeschach& mat1, const MatrixMeschach& mat2);
0078 typedef MatrixMeschach ALIMatrix;
0079 
0080 #endif