<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: sum Things to Consider</title>
	<atom:link href="http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/</link>
	<description>Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Ged Ridgway</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31525</link>
		<dc:creator>Ged Ridgway</dc:creator>
		<pubDate>Thu, 22 Jul 2010 15:58:26 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31525</guid>
		<description>Hi Stephen,

I&#039;ve just had a look at your submission, and I think it performs a different function (though in 2D cases, the results are the same with the dim swapped). I&#039;ve written a comment on your submission illustrating the difference.
http://www.mathworks.com/matlabcentral/fileexchange/16467-apply
I&#039;ve also linked to your function from a comment on my own:
http://www.mathworks.com/matlabcentral/fileexchange/28255#comments

All the best,
Ged</description>
		<content:encoded><![CDATA[<p>Hi Stephen,</p>
<p>I&#8217;ve just had a look at your submission, and I think it performs a different function (though in 2D cases, the results are the same with the dim swapped). I&#8217;ve written a comment on your submission illustrating the difference.<br />
<a href="http://www.mathworks.com/matlabcentral/fileexchange/16467-apply" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/16467-apply</a><br />
I&#8217;ve also linked to your function from a comment on my own:<br />
<a href="http://www.mathworks.com/matlabcentral/fileexchange/28255#comments" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/28255#comments</a></p>
<p>All the best,<br />
Ged</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ged Ridgway</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31524</link>
		<dc:creator>Ged Ridgway</dc:creator>
		<pubDate>Thu, 22 Jul 2010 15:26:48 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31524</guid>
		<description>Hi Loren,

I found something similar,
http://www.mathworks.com/matlabcentral/fileexchange/25472
but decided to implement my above suggestion, to make it simple to do things like
&lt;pre&gt;
  dimfunc(&#039;sum&#039;, data, dim)
  % equivalent to sum(data, dim)
&lt;/pre&gt;

with functions that don&#039;t share sum&#039;s dim-handling behaviour. I hope other people find it useful -- it&#039;s available here:
http://www.mathworks.com/matlabcentral/fileexchange/28255

Best,
Ged</description>
		<content:encoded><![CDATA[<p>Hi Loren,</p>
<p>I found something similar,<br />
<a href="http://www.mathworks.com/matlabcentral/fileexchange/25472" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/25472</a><br />
but decided to implement my above suggestion, to make it simple to do things like</p>
<pre>
  dimfunc('sum', data, dim)
  % equivalent to sum(data, dim)
</pre>
<p>with functions that don&#8217;t share sum&#8217;s dim-handling behaviour. I hope other people find it useful &#8212; it&#8217;s available here:<br />
<a href="http://www.mathworks.com/matlabcentral/fileexchange/28255" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/28255</a></p>
<p>Best,<br />
Ged</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: StephenLL</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31523</link>
		<dc:creator>StephenLL</dc:creator>
		<pubDate>Thu, 22 Jul 2010 13:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31523</guid>
		<description>I am the author of this.  While it doesn&#039;t speed up the calculations it definitely is convenient.

http://www.mathworks.com/matlabcentral/fileexchange/16467-apply</description>
		<content:encoded><![CDATA[<p>I am the author of this.  While it doesn&#8217;t speed up the calculations it definitely is convenient.</p>
<p><a href="http://www.mathworks.com/matlabcentral/fileexchange/16467-apply" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/16467-apply</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31518</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 21 Jul 2010 14:14:34 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31518</guid>
		<description>Ged-

It&#039;s a nice idea and something worth considering.

--Loren</description>
		<content:encoded><![CDATA[<p>Ged-</p>
<p>It&#8217;s a nice idea and something worth considering.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ged Ridgway</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31517</link>
		<dc:creator>Ged Ridgway</dc:creator>
		<pubDate>Wed, 21 Jul 2010 14:00:11 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-31517</guid>
		<description>Code to perform an operation along a chosen dimension, returning the appropriately sized result, must be very frequently duplicated. Do you think it would be worth factoring this out into a separate function that takes any function-handle (which need only consider vectors) an input, and a chosen dimension, which appropriately reshapes the nD-array to 2D, loops over columns calling the function-handle on each, and then reshapes the output? Perhaps this already exists on the file-exchange, but I couldn&#039;t see it...</description>
		<content:encoded><![CDATA[<p>Code to perform an operation along a chosen dimension, returning the appropriately sized result, must be very frequently duplicated. Do you think it would be worth factoring this out into a separate function that takes any function-handle (which need only consider vectors) an input, and a chosen dimension, which appropriately reshapes the nD-array to 2D, loops over columns calling the function-handle on each, and then reshapes the output? Perhaps this already exists on the file-exchange, but I couldn&#8217;t see it&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-29609</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 22 Jul 2008 11:11:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-29609</guid>
		<description>Clare-

Yes, sum can sum a double vector:

&lt;pre&gt;
&lt;code&gt;
x = [.3 .4 pi/3]
y = sum(x)
x =
          0.3          0.4       1.0472
y =
       1.7472
&lt;/code&gt;
&lt;/pre&gt;

You must have something else going on your code w.r.t. indexing.  It looks like your indices into the data you want to sum aer not valid ones.

--Loren</description>
		<content:encoded><![CDATA[<p>Clare-</p>
<p>Yes, sum can sum a double vector:</p>
<pre>
<code>
x = [.3 .4 pi/3]
y = sum(x)
x =
          0.3          0.4       1.0472
y =
       1.7472
</code>
</pre>
<p>You must have something else going on your code w.r.t. indexing.  It looks like your indices into the data you want to sum aer not valid ones.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clare J</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-29608</link>
		<dc:creator>Clare J</dc:creator>
		<pubDate>Tue, 22 Jul 2008 09:15:52 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-29608</guid>
		<description>R2007a - Student Version

When I use sum to sum a vector of type double I get this error message:
??? Subscript indices must either be real positive integers or logicals.

The values in my vector range from 0.6 to 0.9 - so they are all positive but are floats (not integers).  Maybe that is the problem...

But your example here seems to work with floats...

My question is: Can I use sum to sum floats?  (I know cumsum works...)

Thanks.  Btw, your blog has taught me a lot.</description>
		<content:encoded><![CDATA[<p>R2007a &#8211; Student Version</p>
<p>When I use sum to sum a vector of type double I get this error message:<br />
??? Subscript indices must either be real positive integers or logicals.</p>
<p>The values in my vector range from 0.6 to 0.9 &#8211; so they are all positive but are floats (not integers).  Maybe that is the problem&#8230;</p>
<p>But your example here seems to work with floats&#8230;</p>
<p>My question is: Can I use sum to sum floats?  (I know cumsum works&#8230;)</p>
<p>Thanks.  Btw, your blog has taught me a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yehuda S.</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-24688</link>
		<dc:creator>Yehuda S.</dc:creator>
		<pubDate>Thu, 10 Jan 2008 16:34:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-24688</guid>
		<description>Loren -

Thank you - and that explains why it runs longer from the command line compared to some work arounds I tried on the
script.</description>
		<content:encoded><![CDATA[<p>Loren -</p>
<p>Thank you &#8211; and that explains why it runs longer from the command line compared to some work arounds I tried on the<br />
script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-24685</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Thu, 10 Jan 2008 15:58:27 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-24685</guid>
		<description>Yehuda-

It works from a script if you first type

feature accel off

I will report the bug.  Thank you.\

--Loren</description>
		<content:encoded><![CDATA[<p>Yehuda-</p>
<p>It works from a script if you first type</p>
<p>feature accel off</p>
<p>I will report the bug.  Thank you.\</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yehuda S</title>
		<link>http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-24664</link>
		<dc:creator>Yehuda S</dc:creator>
		<pubDate>Thu, 10 Jan 2008 07:10:09 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2007/06/29/sum-things-to-consider/#comment-24664</guid>
		<description>Loren -

I&#039;m running R2007b.
Did you run it straight at the command window ?
Then I also don&#039;t have any problems.
The problem arises when running those lines from a script.</description>
		<content:encoded><![CDATA[<p>Loren -</p>
<p>I&#8217;m running R2007b.<br />
Did you run it straight at the command window ?<br />
Then I also don&#8217;t have any problems.<br />
The problem arises when running those lines from a script.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

