// smatrix.c #ifndef smatrix_C #define smatrix_C #include "smatrix.h" #include "nvector.h" #include "trfutil/trfstream.h" #include // output stream template void smatrix::ostr(std::ostream& stream) const { stream << begin_object; int i = 0; for ( int irow=0; irow<_nrow; irow++ ) { if ( irow ) stream << new_line; for ( int icol=0; icol<=irow; icol++ ) { if ( icol > 0 ) stream << ' '; stream << data[i++]; } } stream << end_object; } // Normalize a matrix. // Transformation which makes all diagonal elements unity. // Zero off-diagonal elements if diagonal is zero. template void normalize(smatrix& sma) { nvector vec(sma.nrow()); for ( int irow=0; irow T operator%(const smatrix& sma, const nvector& vec) { int dim = vec.length(); if ( sma.nrow() != dim ) { T prod = 0; return prod; } T prod = 0.0; for ( int i=0; i& sma ) { // copy matrix to HEP object int dim = sma.nrow(); HepSymMatrix hep(dim); int i, j; for ( i=0; i