Stan Math Library
5.0.0
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
4
#include <
stan/math/prim/meta.hpp
>
5
#include <
stan/math/prim/functor/apply_vector_unary.hpp
>
6
7
namespace
stan
{
8
namespace
math {
9
17
template
<
typename
T, require_not_std_vector_t<T>* =
nullptr
>
18
inline
auto
minus
(
const
T& x) {
19
return
-x;
20
}
21
29
template
<
typename
T>
30
inline
auto
minus
(
const
std::vector<T>& x) {
31
return
apply_vector_unary<std::vector<T>
>
::apply
(
32
x, [](
const
auto
& v) {
return
-v; });
33
}
34
35
}
// namespace math
36
}
// namespace stan
37
38
#endif
stan::math::minus
auto minus(const T &x)
Returns the negation of the specified scalar or matrix.
Definition
minus.hpp:18
stan::math::apply
constexpr decltype(auto) apply(F &&f, Tuple &&t, PreArgs &&... pre_args)
Definition
apply.hpp:52
stan
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition
unit_vector_constrain.hpp:15
apply_vector_unary.hpp
meta.hpp
stan::math::apply_vector_unary
Definition
apply_vector_unary.hpp:17
stan
math
prim
fun
minus.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.