``lgamma``, ``fmin``, and ``fmax`` are called within cython loops.  Using python functions instead of C functions will slow the code immensely.