#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <memory>
#include <cassert>
#include "CLHEP/Matrix/GenMatrix.h"
#include "CLHEP/Matrix/Matrix.h"
#include "CLHEP/Matrix/Vector.h"
#include "Calibration/Tools/interface/matrixSaver.h"
Go to the source code of this file.
Functions | |
std::ostream & | operator<< (std::ostream &outputFile, const CLHEP::HepGenMatrix *saveMe) |
std::istream & | operator>> (std::istream &input, CLHEP::HepGenMatrix &matrix) |
std::ostream& operator<< | ( | std::ostream & | outputFile, |
const CLHEP::HepGenMatrix * | saveMe | ||
) |
Definition at line 29 of file matrixSaver.cc.
References download_sqlite_cfg::outputFile.
{ int numRow = saveMe->num_row () ; int numCol = saveMe->num_col () ; // write out the matrix dimensions outputFile << numRow << '\t' << numCol << '\n' ; // write the elements in the file for (int row=0 ; row<numRow ; ++row) { for (int col=0 ; col<numCol ; ++col) { assert (row < numRow) ; assert (col < numCol) ; outputFile << (*saveMe)[row][col] << '\t' ; } outputFile << '\n' ; } return outputFile ; }
std::istream& operator>> | ( | std::istream & | input, |
CLHEP::HepGenMatrix & | matrix | ||
) |
Definition at line 111 of file matrixSaver.cc.
References collect_tpl::input.
{ int numRow = 0 ; int numCol = 0 ; //PG read the matrix dimension input >> numRow ; input >> numCol ; //PG check whether the matrices have the right dimension assert ( numRow == matrix.num_row () ) ; assert ( numCol == matrix.num_col () ) ; //PG get the matrix elements from the file for (int row=0 ; row<numRow ; ++row) { for (int col=0 ; col<numCol ; ++col) { input >> matrix[row][col] ; assert (col*row < numRow*numCol) ; } } return input ; }