fixing min/max to return indices as well (given an arbitrary dimension)

Fixes #48 #69 
nit: You could use `DIVUP` as defined in THCGeneral.h