Stan Math Library  2.20.0
reverse mode automatic differentiation
dot_self.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_MAT_FUN_DOT_SELF_HPP
2 #define STAN_MATH_FWD_MAT_FUN_DOT_SELF_HPP
3 
6 #include <stan/math/fwd/core.hpp>
8 
9 namespace stan {
10 namespace math {
11 
12 template <typename T, int R, int C>
13 inline fvar<T> dot_self(const Eigen::Matrix<fvar<T>, R, C>& v) {
14  check_vector("dot_self", "v", v);
15  return dot_product(v, v);
16 }
17 
18 } // namespace math
19 } // namespace stan
20 #endif
void check_vector(const char *function, const char *name, const Eigen::Matrix< T, R, C > &x)
Check if the matrix is either a row vector or column vector.
fvar< T > dot_self(const Eigen::Matrix< fvar< T >, R, C > &v)
Definition: dot_self.hpp:13
fvar< T > dot_product(const Eigen::Matrix< fvar< T >, R1, C1 > &v1, const Eigen::Matrix< fvar< T >, R2, C2 > &v2)
Definition: dot_product.hpp:14
This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type.
Definition: fvar.hpp:41

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