Euclidian distance matrix
|
04-16-2016, 10:20 AM
(This post was last modified: 04-16-2016 11:18 AM by in06khattab.)
Post: #1
|
|||
|
|||
Euclidian distance matrix
Is it possible for there to be a function (in 50g or prime) to calculate the euclidean distance or the euclidean cumulative distance matrix?
e.g. From: To |
|||
04-16-2016, 01:31 PM
Post: #2
|
|||
|
|||
RE: Euclidian distance matrix
On the Prime, for the euclidean distance matrix :
Let say that you use M1 and M2 to store your sets of points Code: M1:=[[1.1,3.1],[2.1,4.1],[3.4,3.2]] Then you can get the distance matrix with: Code: MAKEMAT(√((M1(I,1)-M2(J,1))^2+(M1(I,2)-M2(J,2))^2),rowDim(M1),rowDim(M2)) With the fixed 2 number format setting the result is : You can easily create a program for this function. For the cumulative distance matrix do you have a reference explaining how it is calculated ? |
|||
04-17-2016, 02:17 AM
Post: #3
|
|||
|
|||
RE: Euclidian distance matrix
Thank you very much for your help in the distance matrix, it was really useful!
I think the cumulative distance must be done by hand, as there are a lot of changing external variables, as it is an example of dynamic programming and looking at the shortest path. So it is cumulative and adding the smallest value. |
|||
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
I think I have understood how to build the cumulative distance matrix. If I apply the following program: Code: EXPORT CDM(DM) to the euclidean distance matrix in your example I get the same result for the cumulative distance matrix : |
|||
04-17-2016, 09:23 AM
Post: #5
|
|||
|
|||
RE: Euclidian distance matrix
Wow, thanks a lot, that was really useful as I was doing it by hand.
|
|||
04-17-2016, 11:07 AM
Post: #6
|
|||
|
|||
RE: Euclidian distance matrix
That's very good work, Didier! I envy your skill at the details.
You might also like to include the example data for making a "default" distance matrix in Didier's CDM program, (for future reference), as Didier initially described: Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)