added index to THCTensorMath.cu