Hi I am trying to covert this distance formula for rectilinear distance from matlab to python. X1 and X2 are two matrices of two dimensional points and could be differing lengths.
nd = size(X1); n = nd(1);
d = nd(2);
m = size(X2,1);
D = abs(X1(:,ones(1,m)) - X2(:,ones(1,n))') + ...
abs(X1(:,2*ones(1,m)) - X2(:,2*ones(1,n))');
I think the problem I am having most in python is appending the ones matrices with X1 and X2 since they are np.arrays.