python-3.xscipyscipy-spatial

How to find code source of scipy.special.rel_entr function?


I am trying to look for the code source of scipy.special.rel_entr function in GitHub Repo but could not find rel_entr function definition.

I also tried to look in this code: https://github.com/scipy/scipy/pull/6522/files#diff-0


Solution

  • scipy.special.rel_entr is a ufunc. The core calculation that is used by the function is implemented in Cython in the file _convex_analysis.pxd, specifically these lines. All the wrapper code that implements the ufunc rel_entr is generated automatically when SciPy is built, based on configuration data in the file functions.json.