1#ifndef STAN_MATH_PRIM_FUN_DOT_PRODUCT_HPP
2#define STAN_MATH_PRIM_FUN_DOT_PRODUCT_HPP
21template <
typename Vec1,
typename Vec2,
22 require_all_eigen_vector_t<Vec1, Vec2>* =
nullptr,
23 require_not_var_t<return_type_t<Vec1, Vec2>>* =
nullptr>
27 [](
auto&& v1_,
auto&& v2_) {
28 return std::forward<decltype(v1_)>(v1_).dot(
29 std::forward<
decltype(v2_)>(v2_));
31 std::forward<Vec1>(v1), std::forward<Vec2>(v2));
41template <
typename Scalar1,
typename Scalar2,
44inline auto dot_product(
const Scalar1* v1,
const Scalar2* v2,
size_t length) {
46 for (
size_t i = 0; i < length; i++) {
47 result += v1[i] * v2[i];
59template <
typename Scalar1,
typename Scalar2,
typename Alloc1,
typename Alloc2,
62 const std::vector<Scalar1, Alloc1>& v1,
63 const std::vector<Scalar2, Alloc2>& v2) {
auto as_column_vector_or_scalar(T &&a)
as_column_vector_or_scalar of a kernel generator expression.
require_all_t< is_stan_scalar< std::decay_t< Types > >... > require_all_stan_scalar_t
Require all of the types satisfy is_stan_scalar.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
require_all_not_t< is_var< std::decay_t< Types > >... > require_all_not_var_t
Require none of the types satisfy is_var.
auto make_holder(F &&func, Args &&... args)
Calls given function with given arguments.
void check_matching_sizes(const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
Check if two structures at the same size.
auto dot_product(const T_a &a, const T_b &b)
Returns the dot product of the specified vectors.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...