<?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: Thoughts on programming</title>
	<atom:link href="http://betoerend.hopit.de/2009/03/26/thoughts-on-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://betoerend.hopit.de/2009/03/26/thoughts-on-programming/</link>
	<description>fabian&#039;s blog about everything</description>
	<lastBuildDate>Sat, 12 May 2012 12:11:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Paule</title>
		<link>http://betoerend.hopit.de/2009/03/26/thoughts-on-programming/comment-page-1/#comment-4</link>
		<dc:creator>Paule</dc:creator>
		<pubDate>Fri, 27 Mar 2009 07:55:30 +0000</pubDate>
		<guid isPermaLink="false">http://betoerend.hopit.de/?p=97#comment-4</guid>
		<description>Re: Rule 2. Another great way of reducing nesting is to use logical arrays and vectorization (= vector algebra) of data arrays, e.g. in Matlab:

Version 1:

for ii = 1:size(a,1)
    for jj = 1:size(a,2)
       if a(ii,jj) &gt; 5
            a(ii,jj) = sqrt(a(ii,jj));
       end
    end
end

Takes the square root of all elements in an array whose value is greater than 5. Much faster to use the vectorized approach...

Version 2:

b = a &gt; 5;
a(b) = sqrt(a(b));

Cool.</description>
		<content:encoded><![CDATA[<p>Re: Rule 2. Another great way of reducing nesting is to use logical arrays and vectorization (= vector algebra) of data arrays, e.g. in Matlab:</p>
<p>Version 1:</p>
<p>for ii = 1:size(a,1)<br />
    for jj = 1:size(a,2)<br />
       if a(ii,jj) &gt; 5<br />
            a(ii,jj) = sqrt(a(ii,jj));<br />
       end<br />
    end<br />
end</p>
<p>Takes the square root of all elements in an array whose value is greater than 5. Much faster to use the vectorized approach&#8230;</p>
<p>Version 2:</p>
<p>b = a &gt; 5;<br />
a(b) = sqrt(a(b));</p>
<p>Cool.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

