35namespace triqs::utility {
49 template <std::
integral I>
bool is_zero(I
const &x) {
return x == 0; }
59 template <std::
floating_po
int T>
bool is_zero(T
const &x, T tolerance = 100 * std::numeric_limits<T>::epsilon()) {
return std::abs(x) < tolerance; }
69 template <
typename T>
bool is_zero(std::complex<T>
const &z, T tolerance = 100 * std::numeric_limits<T>::epsilon()) {
70 return is_zero(std::real(z), tolerance) &&
is_zero(std::imag(z), tolerance);
80 template <std::
integral I> I
conj(I
const &x) {
return x; }
89 template <std::
floating_po
int T> T
conj(T
const &x) {
return x; }
111 template <std::
integral I> I
real(I
const &x) {
return x; }
120 template <std::
floating_po
int T> T
real(T
const &x) {
return x; }
129 template <
typename Z>
142 template <std::
integral I> I
imag([[maybe_unused]] I
const &x) {
return I{}; }
151 template <std::
floating_po
int T> T
imag([[maybe_unused]] T
const &x) {
return T{}; }
160 template <
typename Z>
I real(I const &x)
Real part of an integral value.
I imag(I const &x)
Imaginary part of an integral value.
I conj(I const &x)
Complex conjugate of an integral value.
bool is_zero(I const &x)
Exact zero check for integral values.
Provides a type trait to check if a type is complex.
Trait that checks if a type is complex.