#include <MatrixMeschach.h>
Public Member Functions | |
void | AddData (ALIuint col, ALIuint lin, ALIdouble data) |
void | Dump (const ALIstring &mtext) |
void | EliminateColumns (ALIint lin_first, ALIint lin_last) |
void | EliminateLines (ALIint lin_first, ALIint lin_last) |
void | inverse () |
const MAT * | Mat () const |
MAT * | MatNonConst () const |
MatrixMeschach () | |
MatrixMeschach (ALIint NoCol, ALIint NoLin) | |
MatrixMeschach (const MatrixMeschach &mat) | |
ALIint | NoColumns () const |
ALIint | NoLines () const |
ALIdouble | operator() (int i, int j) const |
void | operator*= (const ALIdouble num) |
void | operator*= (const MatrixMeschach &mat) |
void | operator+= (const MatrixMeschach &mat) |
MatrixMeschach & | operator= (const MatrixMeschach &mat) |
void | ostrDump (std::ostream &fout, const ALIstring &mtext) |
void | SetCorrelation (ALIint i1, ALIint i2, ALIdouble corr) |
void | setMat (MAT *mat) |
void | setNoColumns (ALIint ncol) |
void | setNoLines (ALIint nlin) |
void | transpose () |
~MatrixMeschach () | |
Private Member Functions | |
void | copy (const MatrixMeschach &mat) |
Private Attributes | |
MAT * | _Mat |
ALIint | _NoColumns |
ALIint | _NoLines |
Definition at line 24 of file MatrixMeschach.h.
MatrixMeschach::MatrixMeschach | ( | ) |
Definition at line 16 of file MatrixMeschach.cc.
{
//- std::cout << "creating matrix0 " << std::endl;
}
Definition at line 29 of file MatrixMeschach.cc.
References _Mat, _NoColumns, and _NoLines.
{ //- std::cout << "creating matrix " << std::endl; _NoLines = NoLin; _NoColumns = NoCol; _Mat = m_get( NoLin, NoCol ); //_data = new ALIdouble[NoCol][NoLin]; }
MatrixMeschach::MatrixMeschach | ( | const MatrixMeschach & | mat | ) |
Definition at line 40 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, copy(), NoColumns(), and NoLines().
MatrixMeschach::~MatrixMeschach | ( | ) |
Definition at line 22 of file MatrixMeschach.cc.
References _Mat.
{ //- std::cout << "deleting matrix " << std::endl; M_FREE(_Mat); }
Definition at line 273 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, dtNoiseDBValidation_cfg::cerr, cuy::col, data, and exception.
Referenced by EliminateColumns(), EliminateLines(), Fit::FillMatricesWithCalibratedParameters(), Fit::FillMatricesWithMeasurements(), and SetCorrelation().
{ if ( lin >= _Mat->m || col >= _Mat->n ) { std::cerr << "EXITING: matrix has only " << _NoLines << " lines and " << _NoColumns << " columns " << std::endl; std::cerr << "EXITING: matrix has only " << _Mat->m << " lines and " << _Mat->n << " columns " << std::endl; std::cerr << " You tried to add data in line " << lin << " and column " << col << std::endl; std::exception(); } _Mat->me[lin][col] = data; }
void MatrixMeschach::copy | ( | const MatrixMeschach & | mat | ) | [private] |
Definition at line 52 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, cuy::col, and MatNonConst().
Referenced by EliminateColumns(), EliminateLines(), MatrixMeschach(), and operator=().
{ // if( ALIUtils::debug >= 5) std::cout << "copy matrix" << mat._Mat << " " << _Mat << " L " << mat.NoLines() << " C " << mat.NoColumns() << " l " << mat.Mat()->m << " c " << mat.Mat()->n <<std::endl; for( ALIint lin=0; lin < _NoLines; lin++ ) { for( ALIint col=0; col < _NoColumns; col++ ) { _Mat->me[lin][col] = mat.MatNonConst()->me[lin][col]; } } // m_copy( mat._Mat, _Mat ); }
void MatrixMeschach::Dump | ( | const ALIstring & | mtext | ) |
Definition at line 366 of file MatrixMeschach.cc.
References gather_cfg::cout, and ostrDump().
Referenced by Fit::addDaMatrixToEntries(), EliminateColumns(), EliminateLines(), Fit::FillMatricesWithMeasurements(), Fit::getFitQuality(), Fit::GetSChi2(), Fit::multiplyMatrices(), and Fit::PropagateErrors().
Definition at line 333 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, AddData(), dtNoiseDBValidation_cfg::cerr, copy(), gather_cfg::cout, ALIUtils::debug, Dump(), cuy::ii, findQualityFiles::jj, Mat(), NoColumns(), and NoLines().
{ //- return; if ( lin_last < lin_first ) { std::cerr << "EXITING: cannot Eliminate Lines in matrix if first line is " << lin_first << " and lastt line is " << lin_last << std::endl; //t std::exception(); return; } ALIint dif = (lin_last - lin_first) + 1; ALIint newANolin = NoLines(); ALIint newANocol = NoColumns() - dif; MatrixMeschach newmat( newANolin, newANocol ); ALIint jjn = 0; for ( ALIint jj=0; jj<NoColumns(); jj++) { if( jj < lin_first || jj > lin_last ) { for ( ALIint ii=0; ii<NoLines(); ii++) { newmat.AddData( ii, jjn, (*this)(ii,jj) ); if(ALIUtils::debug >= 9) std::cout << ii << jjn << "nmat" << newmat.Mat()->me[ii][jjn] << std::endl; } jjn++; } } M_FREE( _Mat ); _Mat = m_get( newANolin, newANocol ); copy( newmat ); _NoLines = _Mat->m; _NoColumns = _Mat->n; Dump( "newnewmat" ); }
Definition at line 299 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, AddData(), dtNoiseDBValidation_cfg::cerr, copy(), gather_cfg::cout, ALIUtils::debug, Dump(), cuy::ii, findQualityFiles::jj, Mat(), NoColumns(), and NoLines().
{ //- return; if ( lin_last < lin_first ) { std::cerr << "EXITING: cannot Eliminate Lines in matrix if first line is " << lin_first << " and lastt line is " << lin_last << std::endl; //t std::exception(); return; } ALIint dif = (lin_last - lin_first) + 1; ALIint newANolin = NoLines() - dif; ALIint newANocol = NoColumns(); MatrixMeschach newmat( newANolin, newANocol ); ALIint iin = 0; for ( ALIint ii=0; ii<NoLines(); ii++) { if( ii < lin_first || ii > lin_last ) { for ( ALIint jj=0; jj<NoColumns(); jj++) { newmat.AddData(iin, jj, (*this)(ii,jj) ); if(ALIUtils::debug >= 9) std::cout << iin << jj << "nmat" << newmat.Mat()->me[iin][jj] << std::endl; } iin++; } } M_FREE( _Mat ); _Mat = m_get( newANolin, newANocol ); copy( newmat ); _NoLines = _Mat->m; _NoColumns = _Mat->n; Dump( "newnewmat" ); }
void MatrixMeschach::inverse | ( | ) |
Definition at line 259 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, gather_cfg::cout, and ALIUtils::debug.
Referenced by Fit::multiplyMatrices(), and Fit::PropagateErrors().
{ if(ALIUtils::debug >= 9) std::cout << "inverse" << _NoLines << "C" << _NoColumns << std::endl; MAT* tempmat = m_get(_NoLines, _NoColumns); ALIdouble factor = 1000.; (*this) *= 1./factor; m_inverse( _Mat, tempmat ); m_copy( tempmat, _Mat ); (*this) *= 1./factor; M_FREE(tempmat); }
const MAT* MatrixMeschach::Mat | ( | ) | const [inline] |
Definition at line 61 of file MatrixMeschach.h.
References _Mat.
Referenced by Fit::dumpEntryAfterFit(), Fit::dumpEntryCorrelations(), EliminateColumns(), EliminateLines(), FittedEntriesSet::FillCorrelations(), FittedEntriesSet::FillEntries(), NtupleManager::FillFitParameters(), CocoaDBMgr::GetOptAlignInfoFromOptO(), Fit::multiplyMatrices(), operator+(), and operator=().
{ return _Mat; }
MAT* MatrixMeschach::MatNonConst | ( | ) | const [inline] |
Definition at line 67 of file MatrixMeschach.h.
References _Mat.
Referenced by copy(), MatrixByMatrix(), operator*(), and Fit::PropagateErrors().
{ return _Mat; }
ALIint MatrixMeschach::NoColumns | ( | ) | const [inline] |
Definition at line 52 of file MatrixMeschach.h.
References _NoColumns.
Referenced by Fit::CheckIfMeasIsProportionalToAnother(), EliminateColumns(), EliminateLines(), MatrixByMatrix(), MatrixMeschach(), operator*(), operator*=(), operator+(), and operator=().
{ return _NoColumns; }
ALIint MatrixMeschach::NoLines | ( | ) | const [inline] |
Definition at line 49 of file MatrixMeschach.h.
References _NoLines.
Referenced by Fit::CheckIfFitPossible(), Fit::CheckIfMeasIsProportionalToAnother(), EliminateColumns(), EliminateLines(), MatrixByMatrix(), MatrixMeschach(), operator*(), operator*=(), operator+(), operator=(), and Fit::setCorrelationFromParamFitted().
{ return _NoLines; }
ALIdouble MatrixMeschach::operator() | ( | int | i, |
int | j | ||
) | const |
void MatrixMeschach::operator*= | ( | const MatrixMeschach & | mat | ) |
Definition at line 86 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, NoColumns(), and NoLines().
{ // std::cout << " multiply matrices " << std::endl; if( _NoColumns != mat.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 " << _NoLines << " x " << _NoColumns << " and " << mat.NoLines() << " x " << mat.NoColumns() << " results in " << _NoLines << " x " << mat.NoColumns() << std::endl; } _NoColumns = mat.NoColumns(); MAT* tempmat = m_get( _NoColumns, _NoLines ); m_transp( _Mat, tempmat); // M_FREE( _Mat ); _Mat = m_get( _NoLines, mat.NoColumns() ); mtrm_mlt( tempmat, mat._Mat, _Mat); // _NoColumns = mat.NoColumns(); // M_FREE(tempmat); }
void MatrixMeschach::operator*= | ( | const ALIdouble | num | ) |
void MatrixMeschach::operator+= | ( | const MatrixMeschach & | mat | ) |
Definition at line 108 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, and dtNoiseDBValidation_cfg::cerr.
{ if(_NoLines != mat._NoLines || _NoColumns != mat._NoColumns ) { std::cerr << "!!!! cannot sum two matrices with different size" << std::endl << "MATRIX 1:" << _NoLines << " X " << _NoColumns << std::endl << "MATRIX 2:" << mat._NoLines << " X " << mat._NoColumns << std::endl; } MAT* tempmat = m_get( _NoColumns, _NoLines ); m_copy( _Mat, tempmat); M_FREE( _Mat ); _Mat = m_get( _NoLines, _NoColumns ); m_add( tempmat, mat._Mat, _Mat); M_FREE(tempmat); }
MatrixMeschach & MatrixMeschach::operator= | ( | const MatrixMeschach & | mat | ) |
Definition at line 66 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, dtNoiseDBValidation_cfg::cerr, copy(), gather_cfg::cout, ALIUtils::debug, exception, Mat(), NoColumns(), and NoLines().
{ if ( this == 0 ) { std::cerr << "EXITING: trying to use 'operator=' with an MatrixMeschach for which memory space is not reserved!!!!" << std::endl; std::exception(); } if ( mat._Mat != _Mat ) { _NoLines = mat._Mat->m; _NoColumns = mat._Mat->n; M_FREE( _Mat ); _Mat = m_get( mat.NoLines(), mat.NoColumns() ); copy( mat ); } if(ALIUtils::debug >= 9) std::cout << "operator=" << mat._Mat << _Mat << NoLines() << NoColumns() << Mat()->m << Mat()->n <<std::endl; return *this; }
void MatrixMeschach::ostrDump | ( | std::ostream & | fout, |
const ALIstring & | mtext | ||
) |
Definition at line 372 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, cuy::ii, and findQualityFiles::jj.
Referenced by Dump(), and Fit::dumpMatrices().
{ fout << "DUMPM@@@@@ " << mtext << " @@@@@" << std::endl; fout << "Matrix is (_Mat)" << _Mat->m << "x" << _Mat->n << std::endl; fout << "Matrix is " << _NoLines << "x" << _NoColumns << std::endl; for (ALIuint ii=0; ii<_Mat->m; ii++) { for (ALIuint jj=0; jj<_Mat->n; jj++) { fout << std::setw(8) << _Mat->me[ii][jj] << " "; } fout << std::endl; } // m_output(_Mat); }
Definition at line 389 of file MatrixMeschach.cc.
References AddData(), gather_cfg::cout, ALIUtils::debug, and mathSSE::sqrt().
Referenced by Fit::setCorrelationFromParamFitted().
{ AddData(i1,i2,corr * sqrt( (*this)(i1,i1)*(*this)(i2,i2) ) ); AddData(i2,i1,corr * sqrt( (*this)(i1,i1)*(*this)(i2,i2) ) ); if(ALIUtils::debug >= 9) std::cout << i1<< i2<< corr << "CORR" << (*this)(i1,i1) << " " << (*this)(i2,i2) << std::endl; //- std::cout << (*this)(i1,i1)*(*this)(i2,i2) << std::endl; //- std::cout << sqrt( (*this)(i1,i1)*(*this)(i2,i2) ) << std::endl; if(ALIUtils::debug >= 9) std::cout << corr * sqrt( (*this)(i1,i1)*(*this)(i2,i2) ) << std::endl; }
void MatrixMeschach::setMat | ( | MAT * | mat | ) | [inline] |
Definition at line 64 of file MatrixMeschach.h.
References _Mat.
Referenced by MatrixByMatrix(), and operator*().
{ _Mat = mat; }
void MatrixMeschach::setNoColumns | ( | ALIint | ncol | ) | [inline] |
Definition at line 55 of file MatrixMeschach.h.
References _NoColumns.
Referenced by MatrixByMatrix(), and operator*().
{ _NoColumns = ncol; }
void MatrixMeschach::setNoLines | ( | ALIint | nlin | ) | [inline] |
void MatrixMeschach::transpose | ( | ) |
Definition at line 217 of file MatrixMeschach.cc.
References _Mat, _NoColumns, _NoLines, and cuy::col.
Referenced by Fit::getFitQuality(), Fit::GetSChi2(), and Fit::multiplyMatrices().
{ // if(ALIUtils::debug >= 9) /* std::cout << "transposed" <<_NoLines<<_NoColumns; MAT* tempmat = m_get(_NoColumns, _NoLines); m_transp( _Mat, tempmat ); std::cout << "transposed" <<_NoLines<<_NoColumns; M_FREE( _Mat ); _Mat = m_get(_NoColumns, _NoLines); std::cout << "transposed" <<_NoLines<<_NoColumns; m_copy( tempmat, _Mat ); std::cout << "transposed" <<_NoLines<<_NoColumns; int ntemp = _NoLines; _NoLines = _NoColumns; _NoColumns = ntemp; M_FREE(tempmat); */ //- std::cout << "transposed" <<_NoLines<<_NoColumns; MAT* tempmat = m_get(_NoColumns, _NoLines); m_transp( _Mat, tempmat ); //- std::cout << "transposed" <<_NoLines<<_NoColumns; M_FREE( _Mat ); _Mat = m_get(_NoColumns, _NoLines); //- std::cout << "transposed" <<_NoLines<<_NoColumns; for( ALIint lin=0; lin < _NoColumns; lin++ ) { for( ALIint col=0; col < _NoLines; col++ ) { //- std::cout << "setting mat " << lin << " " << col << std::endl; _Mat->me[lin][col] = tempmat->me[lin][col]; } } // m_copy( tempmat, _Mat ); //- std::cout << "transposed" <<_NoLines<<_NoColumns; int ntemp = _NoLines; _NoLines = _NoColumns; _NoColumns = ntemp; M_FREE(tempmat); }
MAT* MatrixMeschach::_Mat [private] |
Definition at line 77 of file MatrixMeschach.h.
Referenced by AddData(), copy(), EliminateColumns(), EliminateLines(), inverse(), Mat(), MatNonConst(), MatrixMeschach(), operator()(), operator*=(), operator+=(), operator=(), ostrDump(), setMat(), transpose(), and ~MatrixMeschach().
ALIint MatrixMeschach::_NoColumns [private] |
Definition at line 75 of file MatrixMeschach.h.
Referenced by AddData(), copy(), EliminateColumns(), EliminateLines(), inverse(), MatrixMeschach(), NoColumns(), operator*=(), operator+=(), operator=(), ostrDump(), setNoColumns(), and transpose().
ALIint MatrixMeschach::_NoLines [private] |
Definition at line 74 of file MatrixMeschach.h.
Referenced by AddData(), copy(), EliminateColumns(), EliminateLines(), inverse(), MatrixMeschach(), NoLines(), operator*=(), operator+=(), operator=(), ostrDump(), setNoLines(), and transpose().