1#ifndef STAN_MATH_FWD_FUN_MULTIPLY_HPP
2#define STAN_MATH_FWD_FUN_MULTIPLY_HPP
14template <
typename Mat1,
typename Mat2,
15 require_all_eigen_vt<is_fvar, Mat1, Mat2>* =
nullptr,
16 require_vt_same<Mat1, Mat2>* =
nullptr,
17 require_not_eigen_row_and_col_t<Mat1, Mat2>* =
nullptr>
18inline auto multiply(
const Mat1& m1,
const Mat2& m2) {
20 return (m1 * m2).eval();
23template <
typename Mat1,
typename Mat2,
27inline auto multiply(
const Mat1& m1,
const Mat2& m2) {
29 Eigen::Matrix<value_type_t<Mat1>, Mat1::RowsAtCompileTime,
30 Mat2::ColsAtCompileTime>
31 result(m1.rows(), m2.cols());
32 for (
size_type i = 0; i < m1.rows(); i++) {
33 Eigen::Matrix<value_type_t<Mat1>, 1, Mat1::ColsAtCompileTime> crow
35 for (
size_type j = 0; j < m2.cols(); j++) {
42template <
typename Mat1,
typename Mat2,
43 require_eigen_vt<std::is_floating_point, Mat1>* =
nullptr,
44 require_eigen_vt<is_fvar, Mat2>* =
nullptr,
45 require_not_eigen_row_and_col_t<Mat1, Mat2>* =
nullptr>
46inline auto multiply(
const Mat1& m1,
const Mat2& m2) {
48 Eigen::Matrix<value_type_t<Mat2>, Mat1::RowsAtCompileTime,
49 Mat2::ColsAtCompileTime>
50 result(m1.rows(), m2.cols());
51 for (
size_type i = 0; i < m1.rows(); i++) {
52 Eigen::Matrix<double, 1, Mat1::ColsAtCompileTime> crow = m1.row(i);
53 for (
size_type j = 0; j < m2.cols(); j++) {
54 auto ccol = m2.col(j);
require_t< container_type_check_base< is_eigen, value_type_t, TypeCheck, Check... > > require_eigen_vt
Require type satisfies is_eigen.
void check_multiplicable(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the matrices can be multiplied.
auto multiply(const Mat1 &m1, const Mat2 &m2)
Return the product of the specified matrices.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double elements.
auto dot_product(const T_a &a, const T_b &b)
Returns the dot product of the specified vectors.
require_not_t< math::conjunction< is_eigen_row_vector< Row >, is_eigen_col_vector< Col > > > require_not_eigen_row_and_col_t
Require Row is not a row vector and Col is not a column vector.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...