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
6
7namespace stan {
8namespace math {
9
16template <typename T,
17 require_all_kernel_expressions_and_none_scalar_t<T>* = nullptr>
18auto 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
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
auto sign(const T &x)
Returns signs of the arguments.
Definition sign.hpp:18
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...