Skip to content
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

Merged
merged 2 commits into from
May 20, 2021

Conversation

dalg24
Copy link
Member

@dalg24 dalg24 commented May 18, 2021

See #4033 (comment)

real, imag, and conj

Copy link
Contributor

@masterleinad masterleinad left a 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.

Comment on lines 721 to 724
template <class T>
KOKKOS_INLINE_FUNCTION constexpr Impl::promote_t<T> imag(T) {
return T();
}
Copy link
Contributor

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

Suggested change
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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about ArithmeticType?

Copy link
Contributor

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.

Copy link
Contributor

@brian-kelley brian-kelley left a 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.

@dalg24
Copy link
Member Author

dalg24 commented May 20, 2021

Retest this please

@dalg24 dalg24 merged commit 8f33b38 into kokkos:develop May 20, 2021
@dalg24 dalg24 deleted the missing_complex_overloads branch May 20, 2021 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants