Post Reply 
Euclidian distance matrix
04-17-2016, 05:18 AM
Post: #4
RE: Euclidian distance matrix
If you know how to do by hand then you can write a program that will do it for you Smile

I think I have understood how to build the cumulative distance matrix. If I apply the following program:
Code:
EXPORT CDM(DM)
BEGIN
  LOCAL CM,j,k;
  CM:=MAKEMAT(0,rowDim(DM),colDim(DM));
  FOR j FROM 1 TO rowDim(DM) DO
    FOR k FROM 1 TO colDim(DM) DO
      IF (j==1) AND (k==1) THEN 
        CM(j,k):=DM(j,k); 
      END;
      IF (j==1) AND (k>1) THEN
        CM(j,k):=DM(j,k)+CM(j,k-1);
      END;
      IF (j>1) AND (k==1) THEN
        CM(j,k):=DM(j,k)+CM(j-1,k);
      END;
      IF (j>1) AND (k>1) THEN
        CM(j,k):=DM(j,k)+MIN(CM(j-1,k-1),CM(j-1,k),CM(j,k-1)); 
      END;
    END;
  END;
  RETURN CM;
END;

to the euclidean distance matrix in your example I get the same result for the cumulative distance matrix :
   
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Euclidian distance matrix - in06khattab - 04-16-2016, 10:20 AM
RE: Euclidian distance matrix - Didier Lachieze - 04-17-2016 05:18 AM
RE: Euclidian distance matrix - DrD - 04-17-2016, 11:07 AM



User(s) browsing this thread: 1 Guest(s)