Stan Math Library  2.20.0
reverse mode automatic differentiation
columns_dot_self.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUN_COLUMNS_DOT_SELF_HPP
2 #define STAN_MATH_REV_MAT_FUN_COLUMNS_DOT_SELF_HPP
3 
4 #include <stan/math/rev/meta.hpp>
6 #include <stan/math/rev/core.hpp>
9 
10 namespace stan {
11 namespace math {
12 
18 template <int R, int C>
19 inline Eigen::Matrix<var, 1, C> columns_dot_self(
20  const Eigen::Matrix<var, R, C>& x) {
21  Eigen::Matrix<var, 1, C> ret(1, x.cols());
22  for (size_type i = 0; i < x.cols(); i++) {
23  ret(i) = var(new internal::dot_self_vari(x.col(i)));
24  }
25  return ret;
26 }
27 
28 } // namespace math
29 } // namespace stan
30 #endif
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:33
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double e.
Definition: typedefs.hpp:11
Eigen::Matrix< fvar< T >, 1, C > columns_dot_self(const Eigen::Matrix< fvar< T >, R, C > &x)

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