1#ifndef STAN_MATH_PRIM_FUN_NORM2_HPP
2#define STAN_MATH_PRIM_FUN_NORM2_HPP
20template <
typename Container,
21 require_eigen_vt<std::is_arithmetic, Container>* =
nullptr>
22inline double norm2(Container&& x) {
23 return x.template lpNorm<2>();
34template <
typename Container, require_std_vector_t<Container>* =
nullptr>
35inline auto norm2(Container&& x) {
36 return apply_vector_unary<Container>::reduce(
37 std::forward<Container>(x),
38 [](
auto&& x_) {
return norm2(std::forward<
decltype(x_)>(x_)); });
auto norm2(Container &&x)
Compute the L2 norm of the specified vector of values.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...