DSC
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
statistics.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------- *
2  * This file is part of GEL, http://www.imm.dtu.dk/GEL
3  * Copyright (C) the authors and DTU Informatics
4  * For license and list of authors, see ../../doc/intro.pdf
5  * ----------------------------------------------------------------------- */
6 
11 #ifndef __CGLA_STATISTICS_H__
12 #define __CGLA_STATISTICS_H__
13 
14 #if (_MSC_VER >= 1200)
15 #pragma warning (disable: 4018 4244 4800)
16 #endif
17 
18 #include <vector>
19 
20 namespace CGLA
21 {
22  template<class VT>
23  VT mean(const std::vector<VT>& vec)
24  {
25  VT v(0);
26  for(unsigned int i=0;i<vec.size();++i)
27  v += vec[i];
28  v /= vec.size();
29 
30  return v;
31  }
32 
33 
40  template<class VT, class MT>
41  VT covariance(const std::vector<VT>& vec, MT& C_out);
42 }
43 
44 
45 
46 
47 #endif