// This is core/vnl/vnl_trace.h #ifndef vnl_trace_h_ #define vnl_trace_h_ #ifdef VCL_NEEDS_PRAGMA_INTERFACE #pragma interface #endif //: // \file // \brief Calculate trace of a matrix // \author fsm // // \verbatim // Modifications // LSB (Manchester) 19/3/01 Documentation tidied // Peter Vanroose 27-Jun-2003 made inline and added trace(matrix_fixed) // \endverbatim #include #include #include "vnl/vnl_export.h" //: Calculate trace of a matrix // \relatesalso vnl_matrix template VNL_TEMPLATE_EXPORT T vnl_trace(vnl_matrix const& M) { T sum(0); const unsigned int N = M.rows() VNL_TEMPLATE_EXPORT T vnl_trace(vnl_matrix_fixed const& M) { T sum(0); for (unsigned int i=0; i