Automatic Differentiation
 
Loading...
Searching...
No Matches
rows_dot_product.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_ROWS_DOT_PRODUCT_HPP
2#define STAN_MATH_PRIM_FUN_ROWS_DOT_PRODUCT_HPP
3
7
8namespace stan {
9namespace math {
10
25template <typename Mat1, typename Mat2,
26 require_all_eigen_t<Mat1, Mat2>* = nullptr,
27 require_all_not_eigen_vt<is_var, Mat1, Mat2>* = nullptr>
28inline Eigen::Matrix<return_type_t<Mat1, Mat2>, Mat1::RowsAtCompileTime, 1>
29rows_dot_product(const Mat1& v1, const Mat2& v2) {
30 check_matching_dims("rows_dot_product", "v1", v1, "v2", v2);
31 return (to_ref(v1).cwiseProduct(to_ref(v2))).rowwise().sum();
32}
33
34} // namespace math
35} // namespace stan
36
37#endif
auto rows_dot_product(T_a &&a, T_b &&b)
Returns the dot product of rows of the specified matrices.
void check_matching_dims(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the two containers have the same dimensions.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
Definition to_ref.hpp:18
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...