Automatic Differentiation
 
Loading...
Searching...
No Matches
norm1.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_NORM1_HPP
2#define STAN_MATH_PRIM_FUN_NORM1_HPP
3
7
8namespace stan {
9namespace math {
10
20template <typename Container,
21 require_eigen_vt<std::is_arithmetic, Container>* = nullptr>
22inline double norm1(Container&& x) {
23 return x.template lpNorm<1>();
24}
25
34template <typename Container, require_std_vector_t<Container>* = nullptr>
35inline auto norm1(Container&& x) {
36 return apply_vector_unary<Container>::reduce(
37 std::forward<Container>(x),
38 [](auto&& x_) { return norm1(std::forward<decltype(x_)>(x_)); });
39}
40
41} // namespace math
42} // namespace stan
43
44#endif
auto norm1(Container &&x)
Compute the L1 norm of the specified vector of values.
Definition norm1.hpp:23
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...