Prev: AUtomotive Domain
Next: dynamic matrix
From: Anton on 14 Jun 2010 12:15 Dear experts, Stupid question for you guys, how do you calculate the Euclidean distance between two matrices? For example: Find the distance between [2 3; 1 2] and [4 0; -1 12]. Assumptions: 1. Square matrices 2. Relatively small matrices (3x3 actually) I'm looking for code that is SIMPLE and, more importantly, FAST. Thanks in advance! -Anton
From: Walter Roberson on 14 Jun 2010 12:42 Anton wrote: > how do you calculate the Euclidean > distance between two matrices? > For example: Find the distance between [2 3; 1 2] and [4 0; -1 12]. > > Assumptions: > 1. Square matrices > 2. Relatively small matrices (3x3 actually) > > I'm looking for code that is SIMPLE and, more importantly, FAST. What is "the Euclidean distance between two matrices" ? Euclidean distance is defined for coordinate vectors, not matrices. If your 2x2 matrix is expected to return a vector with two elements, then you will need to define whether you want to take distances row-wise or column-wise.
From: Anton on 14 Jun 2010 13:19 Walter Roberson <roberson(a)hushmail.com> wrote in message <g_sRn.58279$h57.21829(a)newsfe22.iad>... > Anton wrote: > > how do you calculate the Euclidean > > distance between two matrices? > > For example: Find the distance between [2 3; 1 2] and [4 0; -1 12]. > > > > Assumptions: > > 1. Square matrices > > 2. Relatively small matrices (3x3 actually) > > > > I'm looking for code that is SIMPLE and, more importantly, FAST. > > What is "the Euclidean distance between two matrices" ? Euclidean > distance is defined for coordinate vectors, not matrices. If your 2x2 > matrix is expected to return a vector with two elements, then you will > need to define whether you want to take distances row-wise or column-wise. Dear Walter, Woops! Is there perhaps another distance metric commonly used for matrices (tensors)?
From: Walter Roberson on 14 Jun 2010 13:42 Anton wrote: > Woops! Is there perhaps another distance metric commonly used for > matrices (tensors)? Looking at the wikipedia entry about distance metrics, it appears that in differential geometry, metrics are only meaningful for vector spaces, not for tensors. You might, of course, not be restricting yourself to differential calculus, but if not then "distance metric" might have a rather different meaning than Euclidean distance -- e.g., you might be concerned about the geodesic rather than Euclidean distance. I think you might have to give a bit more context.
From: Bruno Luong on 14 Jun 2010 13:53
"Anton " <aorliche(a)gmail.com> wrote in message <hv5oa9$cbl$1(a)fred.mathworks.com>... > > Dear Walter, > > Woops! Is there perhaps another distance metric commonly used for matrices (tensors)? Help NORM. The Frobenious is what is commonly used (fast and I believe equivalent to 2-norm, which is much expensive to compute because it requires finding the largest singular value of the difference). I can't never understand why some people state they want to compute "something", and they do not seem to have a slightest idea what exactly that has to be computed. Bruno |