Stan Math Library
4.9.0
Automatic Differentiation
Loading...
Searching...
No Matches
sign.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_OPENCL_PRIM_SIGN_HPP
2
#define STAN_MATH_OPENCL_PRIM_SIGN_HPP
3
#ifdef STAN_OPENCL
4
5
#include <
stan/math/opencl/kernel_generator.hpp
>
6
7
namespace
stan
{
8
namespace
math {
9
16
template
<
typename
T,
17
require_all_kernel_expressions_and_none_scalar_t<T>* =
nullptr
>
18
auto
sign
(
const
T& x) {
19
return
select
(x == 0, 0,
select
(x < 0, -1, 1));
20
}
21
22
}
// namespace math
23
}
// namespace stan
24
#endif
25
#endif
stan::math::select
select_< as_operation_cl_t< T_condition >, as_operation_cl_t< T_then >, as_operation_cl_t< T_else > > select(T_condition &&condition, T_then &&then, T_else &&els)
Selection operation on kernel generator expressions.
Definition
select.hpp:148
kernel_generator.hpp
stan::math::sign
auto sign(const T &x)
Returns signs of the arguments.
Definition
sign.hpp:18
stan
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition
unit_vector_constrain.hpp:15
stan
math
opencl
prim
sign.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.