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

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 169 of file EvtMatrix.hh.

170{
171 // Chech that the matrices have the correct range.
172 if ( left._range != right._range )
173 {
174 std::cerr << "These matrices cannot be multiplied." << std::endl;
175 return new EvtMatrix< T >();
176 }
177
178 EvtMatrix< T >* mat = new EvtMatrix< T >();
179 mat->setRange( left._range );
180
181 // Initialize the elements of the matrix.
182 for ( int row = 0; row < left._range; row++ )
183 for ( int col = 0; col < right._range; col++ )
184 (*mat)[ row ][ col ] = 0;
185
186 for ( int row = 0; row < left._range; row++ )
187 for ( int col = 0; col < right._range; col++ )
188 for ( int line = 0; line < right._range; line++ )
189 (*mat)[ row ][ col ] += left._mat[ row ][ line ] * right._mat[ line ][ col ];
190
191 return mat;
192}
void setRange(int range)
Definition: EvtMatrix.hh:45