Fixed PairwiseDifference for norms other than 1

OK, it turns out that the inputGrad was wrong before the batch support was added for norms other than 1...  The sign of the gradient was OK, but the magnitude was wrong.  I've fixed this but it REALLY needs review.  

Can you check that I'm using the expand function correctly (I don't think it allocates memory, but I'm not 100% sure)?

I also created "reasonably" comprehensive test for PairwiseDistance in /extra/nn/test/test.lua.  This also needs review.  The tests for fprop and bprop pass.