1#ifndef STAN_MATH_FWD_FUN_NORM1_HPP
2#define STAN_MATH_FWD_FUN_NORM1_HPP
22template <
typename Container, require_eigen_vt<is_fvar, Container>* =
nullptr>
23inline auto norm1(
const Container& x) {
25 to_ref(x), [&](
const auto& v) {
26 using T_fvar_inner =
typename value_type_t<
decltype(v)>::Scalar;
28 v.d().cwiseProduct(
sign(v.val())).sum());
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
auto sign(const T &x)
Returns signs of the arguments.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
auto norm1(const Container &x)
Compute the L1 norm of the specified vector of values.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
This template class represents scalars used in forward-mode automatic differentiation,...