cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
sign.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_COMPLEX_FUNCTIONS_SIGN_H
4#define pRC_CORE_COMPLEX_FUNCTIONS_SIGN_H
5
7
8namespace pRC
9{
10 template<IsComplex T>
11 static inline constexpr auto sign(T const &a)
12 {
13 if(a.real() == zero() && a.imag() == zero())
14 {
15 return zero<T>();
16 }
17 else
18 {
19 return a / abs(a);
20 }
21 }
22}
23#endif // pRC_CORE_COMPLEX_FUNCTIONS_SIGN_H
Definition value.hpp:12
Definition cholesky.hpp:10
static constexpr auto sign(T const &a)
Definition sign.hpp:11
static constexpr auto abs(T const &a)
Definition abs.hpp:11
static constexpr auto zero()
Definition zero.hpp:12