<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238886</link>
    <title>MATLAB Central Newsreader - Vectorization of Euclidean distance calculation</title>
    <description>Feed for thread: Vectorization of Euclidean distance calculation</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sat, 08 Nov 2008 23:10:04 -0500</pubDate>
      <title>Vectorization of Euclidean distance calculation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238886#609765</link>
      <author>Arvind Iyer</author>
      <description>The norm command provides a quick way of calculating Euclidean distance in an N-dimensional space.&lt;br&gt;
e.g,&lt;br&gt;
N = 50;&lt;br&gt;
x1 = randn(1,N);&lt;br&gt;
x2 = randn(1,N);&lt;br&gt;
euclid_dist = norm(x1-x2);&lt;br&gt;
&lt;br&gt;
Consider I have a M points x1, x2.....xM stored in an MxN matrix&lt;br&gt;
[x1;x2.....;xM]&lt;br&gt;
I now want to find the Euclidean distance of each of these point from a test point xT.&lt;br&gt;
&lt;br&gt;
How can this be done in a vectorized way without loops?&lt;br&gt;
I am interested in speeding this up because M is really large in my problem.</description>
    </item>
    <item>
      <pubDate>Sat, 08 Nov 2008 23:58:02 -0500</pubDate>
      <title>Re: Vectorization of Euclidean distance calculation</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238886#609771</link>
      <author>John D'Errico</author>
      <description>&quot;Arvind Iyer&quot; &amp;lt;aiyer@ict.usc.edu&amp;gt; wrote in message &amp;lt;gf568c$ft5$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; The norm command provides a quick way of calculating Euclidean distance in an N-dimensional space.&lt;br&gt;
&amp;gt; e.g,&lt;br&gt;
&amp;gt; N = 50;&lt;br&gt;
&amp;gt; x1 = randn(1,N);&lt;br&gt;
&amp;gt; x2 = randn(1,N);&lt;br&gt;
&amp;gt; euclid_dist = norm(x1-x2);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Consider I have a M points x1, x2.....xM stored in an MxN matrix&lt;br&gt;
&amp;gt; [x1;x2.....;xM]&lt;br&gt;
&amp;gt; I now want to find the Euclidean distance of each of these point from a test point xT.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How can this be done in a vectorized way without loops?&lt;br&gt;
&amp;gt; I am interested in speeding this up because M is really large in my problem.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/18937&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/18937&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
  </channel>
</rss>

