<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Upslope area - Forming and solving the flow matrix</title>
	<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 &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62; and coauthored &#60;a href="http://www.mathworks.com/support/books/book5291.html?category=-1&#38;language=-1"&#62;Digital Image Processing Using MATLAB&#60;/a&#62;. He writes here about image processing concepts, algorithm implementations, and MATLAB.&#60;br&#62;&#60;br&#62;&#60;img&#62;</description>
	<pubDate>Sun, 08 Nov 2009 03:56:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.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>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 "morally triangular" matrix as a matrix A for which there exists a permutation P such that P*A is lower triangular.  John Gilbert defined a "psychologically triangular" 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 "spumoni" output.  John is very pleased that none of these definitions have caught on.

For either case, it'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('spumoni',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's a fun problem ... there's a nifty algorithm behind it.  And in honor of John and Cleve I *didn't* mention the phrase "morally triangular" or "psychologically triangular" in the book!

Now, if you want to know what a "Horror Matrix" is ... just Google "horror matrices" and click "I'm feeling lucky" ;-).  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(&#8217;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>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7177</guid>
		<description>Tim&#8212;"Morally triangular" is the funniest technical phrase I'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>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>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-7168</guid>
		<description>T is an interesting matrix.  It's "morally triangular":  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'm unaware of).

Is T morally triangular because of the direction of the flow always means (at least for "peaks") that there is never a cycle in the graph?

spparms('spumoni',2)
a = T \ ones(numel(E), 1);
sp\: bandwidth = 50+1+50.
sp\: is A diagonal? no.
sp\: is band density (0.03) &#62; 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(&#8217;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>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'm curious as to why you work so hard to remove zero weights from the vv array prior to passing it to "sparse".

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 "sparse" 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>http://blogs.mathworks.com/steve/2007/08/07/upslope-area-flow-matrix/#comment-6958</guid>
		<description>Pisal&#8212;Can you be more specific?  "transforming the signal into 2-D grayscale displays" 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>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>
