Automatic Differentiation
 
Loading...
Searching...
No Matches
minus.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_MINUS_HPP
2#define STAN_MATH_PRIM_FUN_MINUS_HPP
3
6
7namespace stan {
8namespace math {
9
17template <typename T, require_not_std_vector_t<T>* = nullptr>
18inline auto minus(T&& x) {
19 return make_holder([](auto&& x_) { return -x_; }, std::forward<T>(x));
20}
21
29template <typename T, require_std_vector_t<T>* = nullptr>
30inline auto minus(T&& x) {
31 return apply_vector_unary<T>::apply(std::forward<T>(x),
32 [](auto&& v) { return -v; });
33}
34
35} // namespace math
36} // namespace stan
37
38#endif
auto minus(T &&x)
Returns the negation of the specified scalar or matrix.
Definition minus.hpp:18
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 ...