Remove Python loops from dist_metrix.pxd functions

Declare loop counter to be a C type