1#ifndef STAN_MATH_PRIM_FUN_DOT_SELF_HPP
2#define STAN_MATH_PRIM_FUN_DOT_SELF_HPP
13template <
typename T, require_stan_scalar_t<T>* =
nullptr>
18inline double dot_self(
const std::vector<double>& x) {
33template <
typename T, require_eigen_t<T>* =
nullptr,
34 require_not_eigen_vt<is_var, T>* =
nullptr>
36 return make_holder([](
auto&& v_) {
return v_.squaredNorm(); },
37 to_ref(std::forward<T>(v)));
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
auto make_holder(F &&func, Args &&... args)
Calls given function with given arguments.
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
auto dot_self(const T &a)
Returns squared norm of a vector or matrix.
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 ...