Automatic Differentiation
 
Loading...
Searching...
No Matches
tcrossprod.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_FUN_TCROSSPROD_HPP
2#define STAN_MATH_FWD_FUN_TCROSSPROD_HPP
3
9
10namespace stan {
11namespace math {
12
13template <typename EigMat, require_eigen_vt<is_fvar, EigMat>* = nullptr>
14inline Eigen::Matrix<value_type_t<EigMat>, EigMat::RowsAtCompileTime,
15 EigMat::RowsAtCompileTime>
16tcrossprod(const EigMat& m) {
17 if (m.rows() == 0) {
18 return {};
19 }
20 const auto& m_ref = to_ref(m);
21 return m_ref * m_ref.transpose();
22}
23
24} // namespace math
25} // namespace stan
26#endif
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::RowsAtCompileTime > tcrossprod(const EigMat &m)
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
Definition to_ref.hpp:17
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...