1 #ifndef STAN_MATH_PRIM_FUN_CROSSPROD_HPP 2 #define STAN_MATH_PRIM_FUN_CROSSPROD_HPP 3 4 #include <stan/math/prim/meta.hpp> 5 #include <stan/math/prim/fun/typedefs.hpp> 6 #include <stan/math/prim/fun/tcrossprod.hpp> 7 8 namespace stan { 9 namespace math { 10 11 /** 12 * Returns the result of pre-multiplying a matrix by its 13 * own transpose. 14 * 15 * @tparam EigMat type of the matrix (must be derived from \c Eigen::MatrixBase) 16 * @param M Matrix to multiply. 17 * @return Transpose of M times M 18 */ 19 template <typename EigMat, require_eigen_t<EigMat>* = nullptr> crossprod(const EigMat & M)20inline auto crossprod(const EigMat& M) { 21 return tcrossprod(M.transpose()); 22 } 23 24 } // namespace math 25 } // namespace stan 26 27 #endif 28