Tue 22 Nov 2016 08:22:04 PM UTC, comment #5:
Correct, I believe it is because the std::pow(std::complex<T>, int) overload was conditionally compiled out of existence in earlier versions of gcc when using the -std=gnu++11 or -std=gnu++0x command-line option, but was available when building in (previously the default) C++98 mode.
With gcc 5, the specialization was reinstated when building in C++11 mode, and the performance is as it was.
I think a user on Ubuntu 14.04 or Mint 17 could confirm this by using gdb or perf and showing that the inline function std::__complex_pow_unsigned is not being called at all. But I've looked at this for about a half hour now and I'm pretty convinced by inspection that this is the case.
|
Tue 22 Nov 2016 07:29:44 PM UTC, comment #2:
Checking on Win-10 32 bit:
4.0.3:
4.2.0:
There is no noticeable difference.
|
Tue 22 Nov 2016 09:13:13 AM UTC, original submission:
Dear all,
I compiled from scratch 4.0.3 and 4.2.0 and observe the following
So, it seems that integer powers of complex numbers are now treated as double powers. I'm on Mint 17.3 (Ubuntu 14.04). A user in chat showed me that 4.2.0 behaves like 4.0.3 on Ubuntu 16.04. So, it is an Ubuntu 14.04 related problem.
|