Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
dot_self.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__FUNCTIONS__DOT_SELF_HPP__
2 #define __STAN__MATH__FUNCTIONS__DOT_SELF_HPP__
3 
4 #include <vector>
5 
6 namespace stan {
7  namespace math {
8 
9  // x' * x
10  inline double dot_self(const std::vector<double>& x) {
11  double sum = 0.0;
12  for (size_t i = 0; i < x.size(); ++i)
13  sum += x[i] * x[i];
14  return sum;
15  }
16 
17  }
18 }
19 
20 #endif

     [ Stan Home Page ] © 2011–2013, Stan Development Team.