Automatic Differentiation
 
Loading...
Searching...
No Matches
norm2.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_NORM2_HPP
2#define STAN_MATH_PRIM_FUN_NORM2_HPP
3
7
8namespace stan {
9namespace math {
10
20template <typename Container,
21 require_eigen_vt<std::is_arithmetic, Container>* = nullptr>
22inline double norm2(Container&& x) {
23 return x.template lpNorm<2>();
24}
25
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_)); });
39}
40
41} // namespace math
42} // namespace stan
43
44#endif
auto norm2(Container &&x)
Compute the L2 norm of the specified vector of values.
Definition norm2.hpp:22
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...