CMS 3D CMS Logo

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

◆ operator<<()

std::ostream& operator<< ( std::ostream &  outputFile,
const CLHEP::HepGenMatrix &  saveMe 
)

◆ operator>>()

std::istream& operator>> ( std::istream &  input,
CLHEP::HepGenMatrix &  matrix 
)

Definition at line 80 of file matrixSaver.cc.

References cms::cuda::assert(), cuy::col, input, and makeMuonMisalignmentScenario::matrix.

80  {
81  int numRow = 0;
82  int numCol = 0;
83 
84  //PG read the matrix dimension
85  input >> numRow;
86  input >> numCol;
87 
88  //PG check whether the matrices have the right dimension
89  assert(numRow == matrix.num_row());
90  assert(numCol == matrix.num_col());
91 
92  //PG get the matrix elements from the file
93  for (int row = 0; row < numRow; ++row) {
94  for (int col = 0; col < numCol; ++col) {
95  input >> matrix[row][col];
96  assert(col * row < numRow * numCol);
97  }
98  }
99 
100  return input;
101 }
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
col
Definition: cuy.py:1009