Automatic Differentiation
 
Loading...
Searching...
No Matches
apply_vector_unary.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUNCTOR_APPLY_VECTOR_UNARY_HPP
2#define STAN_MATH_REV_FUNCTOR_APPLY_VECTOR_UNARY_HPP
3
6#include <vector>
7
8namespace stan {
9namespace math {
10
15template <typename T>
27 template <typename T2, typename F>
28 static inline auto apply(T2&& x, F&& f) {
29 return std::forward<F>(f)(std::forward<T2>(x));
30 }
31
42 template <typename T2, typename F>
43 static inline auto apply_no_holder(T2&& x, F&& f) {
44 return std::forward<F>(f)(std::forward<T2>(x));
45 }
46
58 template <typename T2, typename F>
59 static inline auto reduce(T2& x, F&& f) {
60 return make_holder(std::forward<F>(f), std::forward<T2>(x));
61 }
62};
63
64} // namespace math
65} // namespace stan
66#endif
require_t< is_var_matrix< std::decay_t< T > > > require_var_matrix_t
Require type satisfies is_var_matrix.
auto make_holder(F &&func, Args &&... args)
Calls given function with given arguments.
Definition holder.hpp:437
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
static auto apply(T2 &&x, F &&f)
Member function for applying a functor to a var_value<T> and subsequently returning a var_value<T>.
static auto reduce(T2 &x, F &&f)
Member function for applying a functor to a var_value<T> and subsequently returning a var.
static auto apply_no_holder(T2 &&x, F &&f)
Member function for applying a functor to a var_value<T> and subsequently returning a var_value<T>.