Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations 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 #include <cstddef>
6 
7 namespace stan {
8  namespace math {
9 
10  // x' * x
11  inline double dot_self(const std::vector<double>& x) {
12  double sum = 0.0;
13  for (size_t i = 0; i < x.size(); ++i)
14  sum += x[i] * x[i];
15  return sum;
16  }
17 
18  }
19 }
20 
21 #endif
double dot_self(const std::vector< double > &x)
Definition: dot_self.hpp:11
double sum(std::vector< double > &x)
Definition: sum.hpp:10

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