-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing complex operations arithmetic types overloads #4034
Conversation
real, imag, and conj
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some suggestions to clarify that the new overloads cannot be used with arbitrary classes.
core/src/Kokkos_Complex.hpp
Outdated
template <class T> | ||
KOKKOS_INLINE_FUNCTION constexpr Impl::promote_t<T> imag(T) { | ||
return T(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful to clarify that T
cannot be arbitrary. Maybe something like
template <class T> | |
KOKKOS_INLINE_FUNCTION constexpr Impl::promote_t<T> imag(T) { | |
return T(); | |
} | |
template <class FloatOrInteger> | |
KOKKOS_INLINE_FUNCTION constexpr Impl::promote_t<FloatOrInteger> imag(FloatInteger) { | |
return FloatOrInteger(); | |
} |
similar to https://en.cppreference.com/w/cpp/numeric/complex/imag2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about ArithmeticType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that sounds reasonable having https://en.cppreference.com/w/cpp/types/is_arithmetic in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these.
Retest this please |
See #4033 (comment)
real, imag, and conj