<?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 for Noldorin&#039;s Blog</title>
	<atom:link href="http://blog.noldorin.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.noldorin.com</link>
	<description>Musings on science, technology, philosophy, and the countless wonders of life</description>
	<lastBuildDate>Fri, 27 Apr 2012 04:31:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>Comment on KD-Trees for .NET by Eric Rini</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-37156</link>
		<dc:creator>Eric Rini</dc:creator>
		<pubDate>Fri, 27 Apr 2012 04:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-37156</guid>
		<description>Very nice library!  I&#039;m gonna give the author a great big thank you. This is really great.</description>
		<content:encoded><![CDATA[<p>Very nice library!  I&#8217;m gonna give the author a great big thank you. This is really great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Bernie</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-32058</link>
		<dc:creator>Bernie</dc:creator>
		<pubDate>Wed, 14 Mar 2012 05:40:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-32058</guid>
		<description>Hi Noldorin, aplologies for being slow to reply - I&#039;ve been busy with work recently. I have a different KdTree implementation and my FindMinumum looks quite different to yours so its a bit hard for me to evaluate your implementation.

Its not very scientific - but I&#039;d suggest writing a unit test that creates a list of items with random locations, add those items to your KdTree, and then remove one item at a time from both the list and the tree. Then you can ensure that removal works using CollectionAssert. It does not guarantee correctness, but it will quickly catch big issues.

My implementation is also hardened to support two items with the same location (and removal of a specific one). But I have simple equality rules - so that was easy to implement for me.</description>
		<content:encoded><![CDATA[<p>Hi Noldorin, aplologies for being slow to reply &#8211; I&#8217;ve been busy with work recently. I have a different KdTree implementation and my FindMinumum looks quite different to yours so its a bit hard for me to evaluate your implementation.</p>
<p>Its not very scientific &#8211; but I&#8217;d suggest writing a unit test that creates a list of items with random locations, add those items to your KdTree, and then remove one item at a time from both the list and the tree. Then you can ensure that removal works using CollectionAssert. It does not guarantee correctness, but it will quickly catch big issues.</p>
<p>My implementation is also hardened to support two items with the same location (and removal of a specific one). But I have simple equality rules &#8211; so that was easy to implement for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Bernie</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-32057</link>
		<dc:creator>Bernie</dc:creator>
		<pubDate>Wed, 14 Mar 2012 05:40:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-32057</guid>
		<description>Hi Noldorin, aplologies for being slow to reply - I&#039;ve been busy with work recently. I have a different KdTree implementation and my FindMinumum looks quite different to yours so its a bit hard for me to evaluate your implementation.

Its not very scientific - but I&#039;d suggest writing a unit test that creates a list of items with random locations, add those items to your KdTree, and then remove one item at a time from both the list and the tree. Then you can ensure that removal works using CollectionAssert. It does not guarantee correctness, but it will quickly catch big issues.

My implementation is also hardened to support two items with the same location (and removal of a specific one). But I have simple equality rules - so that was easy to implement for me.</description>
		<content:encoded><![CDATA[<p>Hi Noldorin, aplologies for being slow to reply &#8211; I&#8217;ve been busy with work recently. I have a different KdTree implementation and my FindMinumum looks quite different to yours so its a bit hard for me to evaluate your implementation.</p>
<p>Its not very scientific &#8211; but I&#8217;d suggest writing a unit test that creates a list of items with random locations, add those items to your KdTree, and then remove one item at a time from both the list and the tree. Then you can ensure that removal works using CollectionAssert. It does not guarantee correctness, but it will quickly catch big issues.</p>
<p>My implementation is also hardened to support two items with the same location (and removal of a specific one). But I have simple equality rules &#8211; so that was easy to implement for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Noldorin</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-31790</link>
		<dc:creator>Noldorin</dc:creator>
		<pubDate>Sat, 10 Mar 2012 21:37:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-31790</guid>
		<description>Bernie,

Regarding both bugs, I think I&#039;ve managed to fix them now. Your suggested change for the first issue seems to make sense, so I&#039;ve included that verbatim. The second wasn&#039;t too tricky, but you can have a look at that too.

Cheers, A.</description>
		<content:encoded><![CDATA[<p>Bernie,</p>
<p>Regarding both bugs, I think I&#8217;ve managed to fix them now. Your suggested change for the first issue seems to make sense, so I&#8217;ve included that verbatim. The second wasn&#8217;t too tricky, but you can have a look at that too.</p>
<p>Cheers, A.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Noldorin</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-31484</link>
		<dc:creator>Noldorin</dc:creator>
		<pubDate>Wed, 07 Mar 2012 18:37:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-31484</guid>
		<description>Okay, so re: the first suggestion I think you&#039;re right actually. You changed my code more than necessary, but I get the idea.

Maybe you could post a reproduction case for the second possible bug? One for the first would be appreciated either; for unit tests, but I should be able to do that anyway.</description>
		<content:encoded><![CDATA[<p>Okay, so re: the first suggestion I think you&#8217;re right actually. You changed my code more than necessary, but I get the idea.</p>
<p>Maybe you could post a reproduction case for the second possible bug? One for the first would be appreciated either; for unit tests, but I should be able to do that anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Bernie</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-31458</link>
		<dc:creator>Bernie</dc:creator>
		<pubDate>Wed, 07 Mar 2012 10:50:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-31458</guid>
		<description>There is actually another bug in FindMinumum that causes Remove to corrupt the tree. I dont know how to translate the fix to your code - I&#039;ll leave that up to you.

You need to make sure you return the SMALLEST of leftMinValue and rightMinValue. So you need to compare them to each other. Right now, you favor leftMinValue.

This can corrupt the tree because you may copy a node up to the pivot that does not respect the splittingDimension (return node.Value).</description>
		<content:encoded><![CDATA[<p>There is actually another bug in FindMinumum that causes Remove to corrupt the tree. I dont know how to translate the fix to your code &#8211; I&#8217;ll leave that up to you.</p>
<p>You need to make sure you return the SMALLEST of leftMinValue and rightMinValue. So you need to compare them to each other. Right now, you favor leftMinValue.</p>
<p>This can corrupt the tree because you may copy a node up to the pivot that does not respect the splittingDimension (return node.Value).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Bernie</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-31457</link>
		<dc:creator>Bernie</dc:creator>
		<pubDate>Wed, 07 Mar 2012 10:42:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-31457</guid>
		<description>The original code finds the minimum value in node.LeftChild and copies it up to the pivot node. It then proceeds to remove it from node.RightChild (which is always null) instead of node.LeftChild. So you end up with duplicate nodes in the tree.</description>
		<content:encoded><![CDATA[<p>The original code finds the minimum value in node.LeftChild and copies it up to the pivot node. It then proceeds to remove it from node.RightChild (which is always null) instead of node.LeftChild. So you end up with duplicate nodes in the tree.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Noldorin</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-31409</link>
		<dc:creator>Noldorin</dc:creator>
		<pubDate>Wed, 07 Mar 2012 00:09:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-31409</guid>
		<description>Thanks for the suggestion. Would you mind briefly summarising what you observed as the problem with the original code?</description>
		<content:encoded><![CDATA[<p>Thanks for the suggestion. Would you mind briefly summarising what you observed as the problem with the original code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Bernie</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-31407</link>
		<dc:creator>Bernie</dc:creator>
		<pubDate>Tue, 06 Mar 2012 23:52:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-31407</guid>
		<description>There is indeed a bug in Remove(). I&#039;ve attached a fixed version - which I havent tested exhaustively but should work better :)

BROKEN CODE:
               if (node.LeftChild == null &amp;&amp; node.RightChild == null)
                    return null;

                if (node.RightChild != null)
                {
                    node.Value = FindMinimum(node.RightChild, dimension, depth + 1);
                }
                else
                {
                    node.Value = FindMinimum(node.LeftChild, dimension, depth + 1);
                    node.LeftChild = null;
                }

                node.RightChild = Remove(node.Value, node.RightChild, depth + 1);
            


FIXED CODE:
                if (node.RightChild != null)
                {
                    node.Value = FindMinimum(node.RightChild, dimension, depth + 1);
                    node.RightChild = Remove(node.Value, node.RightChild, depth + 1);
                }
                else if (node.LeftChild != null)
                {
                    node.Value = FindMinimum(node.LeftChild, dimension, depth + 1);
                    node.RightChild = Remove(node.Value, node.LeftChild, depth + 1);
                    node.LeftChild = null;
                }
                else
                {
                    node = null;
                }</description>
		<content:encoded><![CDATA[<p>There is indeed a bug in Remove(). I&#8217;ve attached a fixed version &#8211; which I havent tested exhaustively but should work better <img src='http://blog.noldorin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>BROKEN CODE:<br />
               if (node.LeftChild == null &amp;&amp; node.RightChild == null)<br />
                    return null;</p>
<p>                if (node.RightChild != null)<br />
                {<br />
                    node.Value = FindMinimum(node.RightChild, dimension, depth + 1);<br />
                }<br />
                else<br />
                {<br />
                    node.Value = FindMinimum(node.LeftChild, dimension, depth + 1);<br />
                    node.LeftChild = null;<br />
                }</p>
<p>                node.RightChild = Remove(node.Value, node.RightChild, depth + 1);</p>
<p>FIXED CODE:<br />
                if (node.RightChild != null)<br />
                {<br />
                    node.Value = FindMinimum(node.RightChild, dimension, depth + 1);<br />
                    node.RightChild = Remove(node.Value, node.RightChild, depth + 1);<br />
                }<br />
                else if (node.LeftChild != null)<br />
                {<br />
                    node.Value = FindMinimum(node.LeftChild, dimension, depth + 1);<br />
                    node.RightChild = Remove(node.Value, node.LeftChild, depth + 1);<br />
                    node.LeftChild = null;<br />
                }<br />
                else<br />
                {<br />
                    node = null;<br />
                }</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on KD-Trees for .NET by Noldorin</title>
		<link>http://blog.noldorin.com/2011/03/kd-trees-for-dotnet/comment-page-1/#comment-30853</link>
		<dc:creator>Noldorin</dc:creator>
		<pubDate>Wed, 29 Feb 2012 00:32:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.noldorin.com/?p=952#comment-30853</guid>
		<description>Hi maaschn. That&#039;s quite how it&#039;s meant to work. Are these indices ones of an array you input? If so, they are implicit and hence not meant to be stored. Try making the actual values of the array/collection structs/tuples that contain the relevant indices.</description>
		<content:encoded><![CDATA[<p>Hi maaschn. That&#8217;s quite how it&#8217;s meant to work. Are these indices ones of an array you input? If so, they are implicit and hence not meant to be stored. Try making the actual values of the array/collection structs/tuples that contain the relevant indices.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

