test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
matrixSaver.h File Reference
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include "CLHEP/Matrix/GenMatrix.h"
#include "CLHEP/Matrix/Matrix.h"
#include "CLHEP/Matrix/Vector.h"

Go to the source code of this file.

Classes

class  matrixSaver
 save (read) CLHEP::HepMatrix to (from) text files More...
 

Functions

std::ostream & operator<< (std::ostream &outputFile, const CLHEP::HepGenMatrix &saveMe)
 
std::istream & operator>> (std::istream &input, CLHEP::HepGenMatrix &matrix)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  outputFile,
const CLHEP::HepGenMatrix &  saveMe 
)
std::istream& operator>> ( std::istream &  input,
CLHEP::HepGenMatrix &  matrix 
)

Definition at line 111 of file matrixSaver.cc.

References assert(), cuy::col, and input.

112 {
113  int numRow = 0 ;
114  int numCol = 0 ;
115 
116  //PG read the matrix dimension
117  input >> numRow ;
118  input >> numCol ;
119 
120  //PG check whether the matrices have the right dimension
121  assert ( numRow == matrix.num_row () ) ;
122  assert ( numCol == matrix.num_col () ) ;
123 
124  //PG get the matrix elements from the file
125  for (int row=0 ; row<numRow ; ++row)
126  {
127  for (int col=0 ; col<numCol ; ++col)
128  {
129  input >> matrix[row][col] ;
130  assert (col*row < numRow*numCol) ;
131  }
132  }
133 
134  return input ;
135 }
assert(m_qm.get())
static std::string const input
Definition: EdmProvDump.cc:44
int col
Definition: cuy.py:1008