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

Support binary operations between different complex types #616

Conversation

aguinet
Copy link
Contributor

@aguinet aguinet commented Oct 22, 2016

For instance, support std::comple + std::complex by
casting the first operand to a std::complex.

@serge-sans-paille
Copy link
Owner

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

@aguinet aguinet force-pushed the fix/std_complex_implicit_cast branch from 9a5e91e to 94269db Compare January 14, 2017 19:02
@aguinet
Copy link
Contributor Author

aguinet commented Jan 14, 2017

Branch rebased on master with clang-format applied on complex.hpp :) !

@serge-sans-paille
Copy link
Owner

@aguinet due to a (new) limitation of Travis, this PR cannot be autoamtically validated #627 solves this issue, you'll need to rebase on it once it's merged by @pbrunet

STD_COMPLEX_IMPLICT_OPERATOR_CAST(+)
STD_COMPLEX_IMPLICT_OPERATOR_CAST(-)
STD_COMPLEX_IMPLICT_OPERATOR_CAST(*)
STD_COMPLEX_IMPLICT_OPERATOR_CAST(/ )

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

Copy link
Contributor Author

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!

Copy link
Contributor Author

@aguinet aguinet Jan 15, 2017

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.

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.

@serge-sans-paille
Copy link
Owner

@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>.
@aguinet aguinet force-pushed the fix/std_complex_implicit_cast branch from 9cfb010 to 889cdaf Compare January 22, 2017 19:18
@aguinet
Copy link
Contributor Author

aguinet commented Jan 22, 2017

Rebase done, go travis go! :)

@serge-sans-paille serge-sans-paille merged commit b821b7e into serge-sans-paille:master Jan 23, 2017
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

3 participants