#if !defined(C10_INTERNAL_INCLUDE_COMPLEX_REMAINING_H) #error \ "c10/util/complex_utils.h is not meant to be individually included. Include c10/util/complex.h instead." #endif #include namespace c10 { template struct is_complex : public std::false_type {}; template struct is_complex> : public std::true_type {}; template struct is_complex> : public std::true_type {}; // Extract double from std::complex; is identity otherwise // TODO: Write in more idiomatic C++17 template struct scalar_value_type { using type = T; }; template struct scalar_value_type> { using type = T; }; template struct scalar_value_type> { using type = T; }; } // namespace c10 namespace std { template class numeric_limits> : public numeric_limits {}; template bool isnan(const c10::complex& v) { return std::isnan(v.real()) || std::isnan(v.imag()); } } // namespace std