
Matthieu, I checked John's suggestion with both (complex * unsigned int) as well as (signed int * complex) The desired optimization was achieved and numerical integrity was retained with the multiprecision type cpp_dec_float.
Thanks for trying this out.
Matthieu, your code is already looking good! I don't know if you would like to go with this suggestion and I can not pressure you to act on it. I do believe, however, that the suggestion to optimize binary ops with POD will arise in a potential review. In my opinion, this optimization will improve your code. So you might want to look into it. But the decision is yours. I can assist you with the testing of our multiprecision type if this would help your progress.
It will be done. It is a non-neglectable optimization. I will also modify the code to take into account your other suggestions: a- Use the right signature for the complex constructor. b- Use the boost::math::constants instead of the gcc extensions. c- Use the template parameters in the function calls. d- Implement binary operators with the integer optimization. e- Improve some functions that do too many computations (e.g. tanh computing exp() twice). (a) has already been done and pushed in my repository. (b) and (c) will be done soon, although I will probably stick to one_div_log10_e instead of ln_10 as long as this modification has not been pushed in the boost release. This will allow for a larger test base. (d) and (e) require more work but will be done over the week-end probably. Cheers, Matthieu -- Matthieu Schaller