Stan Math Library  2.14.0
reverse mode automatic differentiation
tcrossprod.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_MAT_FUN_TCROSSPROD_HPP
2 #define STAN_MATH_FWD_MAT_FUN_TCROSSPROD_HPP
3 
9 #include <vector>
10 
11 namespace stan {
12  namespace math {
13 
14  template<typename T, int R, int C>
15  inline
16  Eigen::Matrix<fvar<T>, R, R>
17  tcrossprod(const Eigen::Matrix<fvar<T>, R, C>& m) {
18  if (m.rows() == 0)
19  return Eigen::Matrix<fvar<T>, R, R>(0, 0);
20  return multiply(m, transpose(m));
21  }
22 
23  }
24 }
25 #endif
Eigen::Matrix< fvar< T >, R1, C1 > multiply(const Eigen::Matrix< fvar< T >, R1, C1 > &m, const fvar< T > &c)
Definition: multiply.hpp:20
Eigen::Matrix< fvar< T >, R, R > tcrossprod(const Eigen::Matrix< fvar< T >, R, C > &m)
Definition: tcrossprod.hpp:17
Eigen::Matrix< T, C, R > transpose(const Eigen::Matrix< T, R, C > &m)
Definition: transpose.hpp:12

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