learn a distance function suitable for use with hinge loss in siamese network

This layer takes two inputs (x0 and x1) and learns a weights vector (w) and scalar bias (b).

y = b + \sum_i w_i f( x0_i - x1_i )

where f(x) = x^2 or f(x) = |x|.

This is useful for learning siamese networks, which has been talked about in other issues (https://github.com/BVLC/caffe/issues/316, https://github.com/BVLC/caffe/pull/546).

Weights sharing has already been merged into dev, but a layer of this type is also necessary.