GEL
2
GEL is a library for Geometry and Linear Algebra
|
00001 #ifndef __CGLA_STATISTICS_H__ 00002 #define __CGLA_STATISTICS_H__ 00003 00004 #if (_MSC_VER >= 1200) 00005 #pragma warning (disable: 4018 4244 4800) 00006 #endif 00007 00008 #include <vector> 00009 00010 namespace CGLA 00011 { 00012 template<class VT> 00013 VT mean(const std::vector<VT>& vec) 00014 { 00015 VT v(0); 00016 for(unsigned int i=0;i<vec.size();++i) 00017 v += vec[i]; 00018 v /= vec.size(); 00019 00020 return v; 00021 } 00022 00023 00030 template<class VT, class MT> 00031 VT covariance(const std::vector<VT>& vec, MT& C_out); 00032 } 00033 00034 00035 00036 00037 #endif