| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

dot_self.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_ARR_FUN_DOT_SELF_HPP
2 #define STAN_MATH_PRIM_ARR_FUN_DOT_SELF_HPP
3
4 #include <vector>
5 #include <cstddef>
6
7 namespace stan {
8 namespace math {
9
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 #endif
stan::math::sum
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
Definition: sum.hpp:20
stan
Definition: log_sum_exp.hpp:8
stan::math::dot_self
fvar< T > dot_self(const Eigen::Matrix< fvar< T >, R, C > &v)
Definition: dot_self.hpp:16

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