Stan Math Library  2.12.0
reverse mode automatic differentiation
columns_dot_self.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_MAT_FUN_COLUMNS_DOT_SELF_HPP
2 #define STAN_MATH_FWD_MAT_FUN_COLUMNS_DOT_SELF_HPP
3 
6 #include <stan/math/fwd/core.hpp>
8 #include <vector>
9 
10 namespace stan {
11  namespace math {
12 
13  template<typename T, int R, int C>
14  inline Eigen::Matrix<fvar<T>, 1, C>
15  columns_dot_self(const Eigen::Matrix<fvar<T>, R, C>& x) {
16  Eigen::Matrix<fvar<T>, 1, C> ret(1, x.cols());
17  for (size_type i = 0; i < x.cols(); i++) {
18  Eigen::Matrix<fvar<T>, R, 1> ccol = x.col(i);
19  ret(0, i) = dot_self(ccol);
20  }
21  return ret;
22  }
23  }
24 }
25 #endif
fvar< T > dot_self(const Eigen::Matrix< fvar< T >, R, C > &v)
Definition: dot_self.hpp:16
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:13
Eigen::Matrix< fvar< T >, 1, C > columns_dot_self(const Eigen::Matrix< fvar< T >, R, C > &x)

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