function [K, dK] = gk( x1, x2, s )
n1 = length(x1);
n2 = length(x2);

x1 = reshape(x1, n1, 1);
x2 = reshape(x2, 1, n2);
r = repmat(x1,1,n2) - repmat(x2,n1,1);
K = exp( - r.^2/s );

dK = - (2/s) * r .* K;