brentp / fishers_exact_test

Fishers Exact Test for Python (Cython)
BSD 3-Clause "New" or "Revised" License
62 stars 21 forks source link

A lof of small things #10

Closed superbobry closed 8 years ago

superbobry commented 8 years ago
brentp commented 8 years ago

LGTM, though the reason for imin2/imax2 was because those are fast inlined versions that avoid the overhead of the python min and max functions. Since those aren't in tight loops, I guess simplicity is preferable here.

superbobry commented 8 years ago

I've checked the code generated by Cython. The line

cdef int lm = max(0, n - (N - K))

is translated to

__pyx_t_1 = (__pyx_v_n - (__pyx_v_N - __pyx_v_K));
__pyx_t_2 = 0;
if (((__pyx_t_1 > __pyx_t_2) != 0)) {
  __pyx_t_3 = __pyx_t_1;
} else {
  __pyx_t_3 = __pyx_t_2;
}
__pyx_v_lm = __pyx_t_3;

Similarly for min.

brentp commented 8 years ago

sweet! thanks