33namespace triqs::stat {
51 template <
typename T> [[nodiscard]]
auto make_real(T &&t) {
return nda::make_regular(nda::real(std::forward<T>(t))); }
54 template <
typename T>
using get_real_t = std::remove_cvref_t<decltype(make_real(std::declval<T>()))>;
57 template <
typename T>
using get_regular_t = std::remove_cvref_t<decltype(nda::make_regular(std::declval<T>()))>;
66 template <StatCompatible T> [[nodiscard]]
auto zeroed_sample([[maybe_unused]] T
const &sample) {
67 if constexpr (nda::Scalar<T>) {
86 template <StatCompatible T> [[nodiscard]]
auto nan_sample([[maybe_unused]] T
const &sample) {
87 if constexpr (nda::Scalar<T>) {
88 using real_t = std::remove_cvref_t<decltype(std::real(std::declval<T>()))>;
89 return T{std::numeric_limits<real_t>::quiet_NaN()};
92 using real_elem_t = std::remove_cvref_t<decltype(std::real(std::declval<elem_t>()))>;
94 res() = elem_t{std::numeric_limits<real_elem_t>::quiet_NaN()};
std::remove_cvref_t< decltype(nda::make_regular(std::declval< T >()))> get_regular_t
Type trait to get the type that would be returned by nda::make_regular.
std::remove_cvref_t< decltype(make_real(std::declval< T >()))> get_real_t
Type trait to get the type that would be returned by triqs::stat::make_real.
auto nan_sample(T const &sample)
Get a sample with all elements set to NaN.
auto zeroed_sample(T const &sample)
Get a sample with all elements set to zero.
auto abs_square(auto const &x)
Calculate the (elementwise) absolute square of an array/view/scalar.
auto make_real(T &&t)
Make a given object real and regular.
Provides various concepts for the Utilities.