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
Support binary operations between different complex types #616
Support binary operations between different complex types #616
Conversation
looks ok to me, just waiting for a few test cases :-) Also, https://travis-ci.org/serge-sans-paille/pythran/jobs/169716049 is not passing because you should run clang-format-3.6 on the c++ files |
9a5e91e
to
94269db
Compare
Branch rebased on master with clang-format applied on complex.hpp :) ! |
STD_COMPLEX_IMPLICT_OPERATOR_CAST(+) | ||
STD_COMPLEX_IMPLICT_OPERATOR_CAST(-) | ||
STD_COMPLEX_IMPLICT_OPERATOR_CAST(*) | ||
STD_COMPLEX_IMPLICT_OPERATOR_CAST(/ ) |
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.
ISTM the operator already exists when T
== U
... how do you handle the conflict?
Without a test, it's hard to tell if this work, please add a few in pythran/tests/test_complex.py
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.
Hmmm indeed, gonna check that!
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 repushed the branch with two tests added. It checks whether the operator + works with both operands the same type and different type. Both tests works. My understanding is that, as the operator+ is well-defined for std::complex, it doesn't try the templated version.
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.
ok. LGTM if travis is ok too.
a3a0a67
to
9cfb010
Compare
@aguinet you can rebase now. |
For instance, support std::complex<double> + std::complex<long double> by casting the first operand to a std::complex<long double>.
9cfb010
to
889cdaf
Compare
Rebase done, go travis go! :) |
For instance, support std::comple + std::complex by
casting the first operand to a std::complex.