<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.fr/matlabcentral/newsreader/view_thread/288813</link>
    <title>MATLAB Central Newsreader - how to vectorise formula</title>
    <description>Feed for thread: how to vectorise formula</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 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.fr/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 08 Aug 2010 22:52:05 +0000</pubDate>
      <title>how to vectorise formula</title>
      <link>http://www.mathworks.fr/matlabcentral/newsreader/view_thread/288813#769603</link>
      <author>Richard </author>
      <description>Hi, having difficulty working out how to vectorise this formula&lt;br&gt;
&lt;br&gt;
for j=1:x&lt;br&gt;
sum over h=1:n of U(h)*G(h,j) * sum over t=1:m of (X(h,t)*P(t))/G(h,t)&lt;br&gt;
&lt;br&gt;
Any help much appreciated.&lt;br&gt;
thanks.</description>
    </item>
    <item>
      <pubDate>Sun, 08 Aug 2010 23:51:05 +0000</pubDate>
      <title>Re: how to vectorise formula</title>
      <link>http://www.mathworks.fr/matlabcentral/newsreader/view_thread/288813#769607</link>
      <author>Roger Stafford</author>
      <description>"Richard " &amp;lt;REMOVETHISrcaldwellie@yahoo.com&amp;gt; wrote in message &amp;lt;i3ncel$s9b$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi, having difficulty working out how to vectorise this formula&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; for j=1:x&lt;br&gt;
&amp;gt; sum over h=1:n of U(h)*G(h,j) * sum over t=1:m of (X(h,t)*P(t))/G(h,t)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any help much appreciated.&lt;br&gt;
&amp;gt; thanks.&lt;br&gt;
- - - - - - - - - - - -&lt;br&gt;
&amp;nbsp;&amp;nbsp;Your expression is somewhat difficult to interpret but does this do what you want?&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;((U(:).*((X./G)*P(:))).')*G &lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Mon, 09 Aug 2010 00:48:04 +0000</pubDate>
      <title>Re: how to vectorise formula</title>
      <link>http://www.mathworks.fr/matlabcentral/newsreader/view_thread/288813#769612</link>
      <author>Roger Stafford</author>
      <description>"Roger Stafford" &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &amp;lt;i3nft9$sc0$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;   Your expression is somewhat difficult to interpret but does this do what you want?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   ((U(:).*((X./G)*P(:))).')*G &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
- - - - - - - - - - -&lt;br&gt;
&amp;nbsp;&amp;nbsp;I just realized that since the same G matrix appears twice in the above expression that implies that x is equal to m.  If that is not so, you would have to modify the formula, perhaps something like this:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;((U(:).*((X./G(:,1:m))*P(:))).')*G(:,1:t)&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Mon, 09 Aug 2010 09:19:07 +0000</pubDate>
      <title>Re: how to vectorise formula</title>
      <link>http://www.mathworks.fr/matlabcentral/newsreader/view_thread/288813#769677</link>
      <author>Richard </author>
      <description>"Roger Stafford" &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &amp;lt;i3nj84$n2m$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; "Roger Stafford" &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &amp;lt;i3nft9$sc0$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;   Your expression is somewhat difficult to interpret but does this do what you want?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;   ((U(:).*((X./G)*P(:))).')*G &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; - - - - - - - - - - -&lt;br&gt;
&amp;gt;   I just realized that since the same G matrix appears twice in the above expression that implies that x is equal to m.  If that is not so, you would have to modify the formula, perhaps something like this:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  ((U(:).*((X./G(:,1:m))*P(:))).')*G(:,1:t)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
Hi Roger, thanks. Although the G matrix appears twice, the first time its a specific column vector from G and the second time its the complete matrix. I 'think' I've vectorised it as &lt;br&gt;
(U.*G(:,j))'*(P'*(X(:,:)./G(:,:))')'&lt;br&gt;
the amount of columns in G = t</description>
    </item>
  </channel>
</rss>
