BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtMatrix.hh File Reference
#include <sstream>
#include <vector>

Go to the source code of this file.

Classes

class  EvtMatrix< T >

Functions

template<class T>
EvtMatrix< T > * operator* (const EvtMatrix< T > &left, const EvtMatrix< T > &right)

Function Documentation

◆ operator*()

template<class T>
EvtMatrix< T > * operator* ( const EvtMatrix< T > & left,
const EvtMatrix< T > & right )

Definition at line 147 of file EvtMatrix.hh.

147 {
148 // Chech that the matrices have the correct range.
149 if ( left._range != right._range )
150 {
151 std::cerr << "These matrices cannot be multiplied." << std::endl;
152 return new EvtMatrix<T>();
153 }
154
155 EvtMatrix<T>* mat = new EvtMatrix<T>();
156 mat->setRange( left._range );
157
158 // Initialize the elements of the matrix.
159 for ( int row = 0; row < left._range; row++ )
160 for ( int col = 0; col < right._range; col++ ) ( *mat )[row][col] = 0;
161
162 for ( int row = 0; row < left._range; row++ )
163 for ( int col = 0; col < right._range; col++ )
164 for ( int line = 0; line < right._range; line++ )
165 ( *mat )[row][col] += left._mat[row][line] * right._mat[line][col];
166
167 return mat;
168}
void setRange(int range)
Definition EvtMatrix.hh:41