1#ifndef STAN_MATH_PRIM_FUN_TCROSSPROD_HPP
2#define STAN_MATH_PRIM_FUN_TCROSSPROD_HPP
20template <
typename T, require_eigen_vt<std::is_arithmetic, T>* =
nullptr>
21inline Eigen::Matrix<value_type_t<T>, T::RowsAtCompileTime,
27 const auto& M_ref =
to_ref(M);
29 return M_ref * M_ref.transpose();
31 Eigen::Matrix<value_type_t<T>, T::RowsAtCompileTime, T::RowsAtCompileTime>
32 result(M.rows(), M.rows());
33 return result.setZero().template selfadjointView<Eigen::Upper>().rankUpdate(
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.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...