lab-cosmo / librascal

A scalable and versatile library to generate representations for atomic-scale learning
https://lab-cosmo.github.io/librascal/
GNU Lesser General Public License v2.1
80 stars 17 forks source link

rename math::pow to math::fast_pow #227

Open Luthaf opened 5 years ago

Luthaf commented 5 years ago

Relying on the same name means that std::pow can be called instead (see https://github.com/cosmo-epfl/librascal/pull/225#discussion_r348050113)

ceriottm commented 5 years ago

What are the scenarios in which it would risk name-clashing with std::pow? If rename is needed to avoid this, I would favor something like ipow or int_pow, since the function is not "fast" is just implemented specifically for integer exponents.

Luthaf commented 5 years ago

What are the scenarios in which it would risk name-clashing with std::pow?

For example, in https://github.com/cosmo-epfl/librascal/pull/225#discussion_r348050113, @felixmusil changed some types to make sure a call to math::pow was made, previous code was using std::pow.

Luthaf commented 5 years ago

Also, since pow is a C function from libm, it exists both as std::pow and ::pow in the global namespace. Thus calling pow without namespace from inside rascal::math can match both std::pow and rascal::math::pow