1#ifndef LINEARALGEBRA_SRC_MOLPRO_LINALG_SCALAR_TRAITS_H_
2#define LINEARALGEBRA_SRC_MOLPRO_LINALG_SCALAR_TRAITS_H_
84template <
typename value_type>
87 if constexpr (std::is_same_v<real_t, double>) {
88 return tolerance_for_double;
90 return real_t(tolerance_for_double) *
91 (std::numeric_limits<real_t>::epsilon() / real_t(std::numeric_limits<double>::epsilon()));
real_type_t< T > real_part(const T &x)
The real part of a scalar; the value itself for a real type.
Definition scalar_traits.h:58
T conjugate(const T &x)
Complex conjugate, staying within the scalar type; the identity for a real type.
Definition scalar_traits.h:47
typename real_type< T >::type real_type_t
The real type underlying T, i.e. T itself for a real type and U for std::complex<U>.
Definition scalar_traits.h:43
real_type_t< T > imaginary_part(const T &x)
The imaginary part of a scalar; zero for a real type.
Definition scalar_traits.h:68
real_type_t< value_type > precision_scaled(double tolerance_for_double)
Rescale a tolerance that was calibrated for IEEE double precision to the working precision.
Definition scalar_traits.h:85
Definition scalar_traits.h:19
T type
Definition scalar_traits.h:32
The real type underlying a (possibly complex) scalar type.
Definition scalar_traits.h:26
T type
Definition scalar_traits.h:27