<?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: Upslope area &#8211; Forming and solving the flow matrix</title>
	<atom:link href="http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/</link>
	<description>Steve Eddins manages the Image &#38; Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.</description>
	<lastBuildDate>Sat, 11 Feb 2012 18:27:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Tim Davis</title>
		<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7225</link>
		<dc:creator>Tim Davis</dc:creator>
		<pubDate>Thu, 23 Aug 2007 22:03:53 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7225</guid>
		<description>That would make the matrix morally triangular, or at least psychologically triangular.

Cleve Moler defined a &quot;morally triangular&quot; matrix as a matrix A for which there exists a permutation P such that P*A is lower triangular.  John Gilbert defined a &quot;psychologically triangular&quot; matrix as a full rank matrix A such that P*A*Q is upper or lower triangular for some P and Q.  These are just *very* informal definitions ... but the phrase did make it into the &quot;spumoni&quot; output.  John is very pleased that none of these definitions have caught on.

For either case, it&#039;s quite simple to find the P and Q, if they exist.  The check done each and every time x=A\b occurs when A is sparse (and not diagonal, banded, or triangular) which you can see with the spparms(&#039;spumoni&#039;,2) command, followed by x=A\b for sparse A.  The algorithm to detect moral/psycho triangularity is a homework exercise in my sparse book.  It&#039;s a fun problem ... there&#039;s a nifty algorithm behind it.  And in honor of John and Cleve I *didn&#039;t* mention the phrase &quot;morally triangular&quot; or &quot;psychologically triangular&quot; in the book!

Now, if you want to know what a &quot;Horror Matrix&quot; is ... just Google &quot;horror matrices&quot; and click &quot;I&#039;m feeling lucky&quot; ;-).  Some matrices are a horror to direct methods, and others a horror for iterative methods.</description>
		<content:encoded><![CDATA[<p>That would make the matrix morally triangular, or at least psychologically triangular.</p>
<p>Cleve Moler defined a &#8220;morally triangular&#8221; matrix as a matrix A for which there exists a permutation P such that P*A is lower triangular.  John Gilbert defined a &#8220;psychologically triangular&#8221; matrix as a full rank matrix A such that P*A*Q is upper or lower triangular for some P and Q.  These are just *very* informal definitions &#8230; but the phrase did make it into the &#8220;spumoni&#8221; output.  John is very pleased that none of these definitions have caught on.</p>
<p>For either case, it&#8217;s quite simple to find the P and Q, if they exist.  The check done each and every time x=A\b occurs when A is sparse (and not diagonal, banded, or triangular) which you can see with the spparms(&#8216;spumoni&#8217;,2) command, followed by x=A\b for sparse A.  The algorithm to detect moral/psycho triangularity is a homework exercise in my sparse book.  It&#8217;s a fun problem &#8230; there&#8217;s a nifty algorithm behind it.  And in honor of John and Cleve I *didn&#8217;t* mention the phrase &#8220;morally triangular&#8221; or &#8220;psychologically triangular&#8221; in the book!</p>
<p>Now, if you want to know what a &#8220;Horror Matrix&#8221; is &#8230; just Google &#8220;horror matrices&#8221; and click &#8220;I&#8217;m feeling lucky&#8221; ;-).  Some matrices are a horror to direct methods, and others a horror for iterative methods.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7177</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 23 Aug 2007 00:03:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7177</guid>
		<description>Tim&#8212;&quot;Morally triangular&quot; is the funniest technical phrase I&#039;ve heard in a while!  I believe that as long as plateaus are handled correctly, the fact that water flows only downhill means that there are no cycles in the graph.</description>
		<content:encoded><![CDATA[<p>Tim&mdash;&#8221;Morally triangular&#8221; is the funniest technical phrase I&#8217;ve heard in a while!  I believe that as long as plateaus are handled correctly, the fact that water flows only downhill means that there are no cycles in the graph.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7176</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 23 Aug 2007 00:01:28 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7176</guid>
		<description>Tim&#8212;In an earlier version of flow_matrix.m, I was constructing the ii, jj, and w vectors as you suggest.  The problem is that it took too much memory.  I was running out of memory on image sizes that I wanted the code to be able to handle.  Removing the zero-valued elements as the vectors are built up reduces the memory requirement significantly, because in the upslope area calculation most pixels receive flow from only 2-3 of their 8 neighbors.</description>
		<content:encoded><![CDATA[<p>Tim&mdash;In an earlier version of flow_matrix.m, I was constructing the ii, jj, and w vectors as you suggest.  The problem is that it took too much memory.  I was running out of memory on image sizes that I wanted the code to be able to handle.  Removing the zero-valued elements as the vectors are built up reduces the memory requirement significantly, because in the upslope area calculation most pixels receive flow from only 2-3 of their 8 neighbors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Davis</title>
		<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7168</link>
		<dc:creator>Tim Davis</dc:creator>
		<pubDate>Wed, 22 Aug 2007 22:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7168</guid>
		<description>T is an interesting matrix.  It&#039;s &quot;morally triangular&quot;:  a permutation of a triangular matrix, which means that a=T\b just permutes and does a forward or backsolve (which one depends on details inside x=A\b I&#039;m unaware of).

Is T morally triangular because of the direction of the flow always means (at least for &quot;peaks&quot;) that there is never a cycle in the graph?

spparms(&#039;spumoni&#039;,2)
a = T \ ones(numel(E), 1);
sp\: bandwidth = 50+1+50.
sp\: is A diagonal? no.
sp\: is band density (0.03) &gt; bandden (0.50) to try banded solver? no.
sp\: is A triangular? no.
sp\: is A morally triangular? yes.
sp\: permute and solve.</description>
		<content:encoded><![CDATA[<p>T is an interesting matrix.  It&#8217;s &#8220;morally triangular&#8221;:  a permutation of a triangular matrix, which means that a=T\b just permutes and does a forward or backsolve (which one depends on details inside x=A\b I&#8217;m unaware of).</p>
<p>Is T morally triangular because of the direction of the flow always means (at least for &#8220;peaks&#8221;) that there is never a cycle in the graph?</p>
<p>spparms(&#8216;spumoni&#8217;,2)<br />
a = T \ ones(numel(E), 1);<br />
sp\: bandwidth = 50+1+50.<br />
sp\: is A diagonal? no.<br />
sp\: is band density (0.03) &gt; bandden (0.50) to try banded solver? no.<br />
sp\: is A triangular? no.<br />
sp\: is A morally triangular? yes.<br />
sp\: permute and solve.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Davis</title>
		<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7167</link>
		<dc:creator>Tim Davis</dc:creator>
		<pubDate>Wed, 22 Aug 2007 22:36:26 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7167</guid>
		<description>In flow_matrix.m, you do a nice job of constructing the sparse matrix.  But I&#039;m curious as to why you work so hard to remove zero weights from the vv array prior to passing it to &quot;sparse&quot;.

T=sparse(ii,jj,vv) will do that for you.  Just change

    non_zero_weight = p ~= 0;

    ii = [ii; i(non_zero_weight)]; %#ok
    jj = [jj; j(non_zero_weight)]; %#ok
    vv = [vv; p(non_zero_weight)]; %#ok

to

    ii = [ii ; i] ;   %#ok
    jj = [jj ; j] ;   %#ok
    vv = [vv ; p] ;   %#ok

and in doing that, ii, jj, vv are now of a known size a priori, and can be preallocated as a side benefit.

The main benefit is that the code is simpler ... no need to do the work when &quot;sparse&quot; is doing it for you.  I doubt that this is a speed issue, just a clarity one.</description>
		<content:encoded><![CDATA[<p>In flow_matrix.m, you do a nice job of constructing the sparse matrix.  But I&#8217;m curious as to why you work so hard to remove zero weights from the vv array prior to passing it to &#8220;sparse&#8221;.</p>
<p>T=sparse(ii,jj,vv) will do that for you.  Just change</p>
<p>    non_zero_weight = p ~= 0;</p>
<p>    ii = [ii; i(non_zero_weight)]; %#ok<br />
    jj = [jj; j(non_zero_weight)]; %#ok<br />
    vv = [vv; p(non_zero_weight)]; %#ok</p>
<p>to</p>
<p>    ii = [ii ; i] ;   %#ok<br />
    jj = [jj ; j] ;   %#ok<br />
    vv = [vv ; p] ;   %#ok</p>
<p>and in doing that, ii, jj, vv are now of a known size a priori, and can be preallocated as a side benefit.</p>
<p>The main benefit is that the code is simpler &#8230; no need to do the work when &#8220;sparse&#8221; is doing it for you.  I doubt that this is a speed issue, just a clarity one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-6958</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 14 Aug 2007 13:33:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-6958</guid>
		<description>Pisal&#8212;Can you be more specific?  &quot;transforming the signal into 2-D grayscale displays&quot; is pretty vague.</description>
		<content:encoded><![CDATA[<p>Pisal&mdash;Can you be more specific?  &#8220;transforming the signal into 2-D grayscale displays&#8221; is pretty vague.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PISAL</title>
		<link>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-6945</link>
		<dc:creator>PISAL</dc:creator>
		<pubDate>Thu, 09 Aug 2007 01:44:42 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-6945</guid>
		<description>Dear Sir,
I have been following and learning MATLAB alot from ur blog. I found it very useful.
Currently, I have been assigned to do a project regarding the transforming the signal into 2-D grayscale displays. I have alot difficulties in doing this project. Would u mind giving me some idea that might be useful to me?
Ur idea is really appreciated? THanks
With Regard,</description>
		<content:encoded><![CDATA[<p>Dear Sir,<br />
I have been following and learning MATLAB alot from ur blog. I found it very useful.<br />
Currently, I have been assigned to do a project regarding the transforming the signal into 2-D grayscale displays. I have alot difficulties in doing this project. Would u mind giving me some idea that might be useful to me?<br />
Ur idea is really appreciated? THanks<br />
With Regard,</p>
]]></content:encoded>
	</item>
</channel>
</rss>

