<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Conal Elliott &#187; comparison</title>
	<atom:link href="http://conal.net/blog/tag/comparison/feed" rel="self" type="application/rss+xml" />
	<link>http://conal.net/blog</link>
	<description>Inspirations &#38; experiments, mainly about denotative/functional programming in Haskell</description>
	<lastBuildDate>Thu, 25 Jul 2019 18:15:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.17</generator>
	<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=conal&amp;popout=1&amp;url=http%3A%2F%2Fconal.net%2Fblog%2F&amp;language=en_US&amp;category=text&amp;title=Conal+Elliott&amp;description=Inspirations+%26amp%3B+experiments%2C+mainly+about+denotative%2Ffunctional+programming+in+Haskell&amp;tags=blog" type="text/html" />
	<item>
		<title>Comparing formulations of higher-dimensional, higher-order derivatives</title>
		<link>http://conal.net/blog/posts/comparing-formulations-of-higher-dimensional-higher-order-derivatives</link>
		<comments>http://conal.net/blog/posts/comparing-formulations-of-higher-dimensional-higher-order-derivatives#comments</comments>
		<pubDate>Sun, 25 Jan 2009 01:40:07 +0000</pubDate>
		<dc:creator><![CDATA[Conal]]></dc:creator>
				<category><![CDATA[Functional programming]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[derivative]]></category>
		<category><![CDATA[linear map]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://conal.net/blog/?p=77</guid>
		<description><![CDATA[I just reread Jason Foutz&#8217;s post Higher order multivariate automatic differentiation in Haskell, as I&#8217;m thinking about this topic again. I like his trick of using an IntMap to hold the partial derivatives and (recursively) the partials of those partials, etc. Some thoughts: I bet one can eliminate the constant (C) case in Jason&#8217;s representation, [&#8230;]]]></description>
				<content:encoded><![CDATA[<!-- 

Title: Comparing formulations of higher-dimensional, higher-order derivatives

Tags: derivative, linear map, math, comparison

URL: http://conal.net/blog/posts/comparing-formulations-of-higher-dimensional-higher-order-derivatives/

-->

<!-- references -->

<!-- -->

<p>I just reread Jason Foutz&#8217;s post <a href="http://metavar.blogspot.com/2008/02/higher-order-multivariate-automatic.html">Higher order multivariate automatic differentiation in Haskell</a>, as I&#8217;m thinking about this topic again.  I like his trick of using an <code>IntMap</code> to hold the partial derivatives and (recursively) the partials of those partials, etc.</p>

<p>Some thoughts:</p>

<ul>
<li><p>I bet one can eliminate the constant (<code>C</code>) case in Jason&#8217;s representation, and hence 3/4 of the cases to handle, without much loss in performance.  He already has a fairly efficient representation of constants, which is a <code>D</code> with an empty <code>IntMap</code>.</p></li>
<li><p>I imagine there&#8217;s also a nice generalization of the code for combining two finite maps used in his third multiply case.  The code&#8217;s meaning and correctness follows from a model for those maps as total functions with missing elements denoting a default value (zero in this case).</p></li>
<li><p>Jason&#8217;s data type reminds me of a sparse matrix representation, but cooler in how it&#8217;s infinitely nested.  Perhaps depth <em>n</em> (starting with zero) is a sparse <em>n-dimensional</em> matrix.</p></li>
<li><p>Finally, I suspect there&#8217;s a close connection between Jason&#8217;s <code>IntMap</code>-based implementation and my <code>LinearMap</code>-based implementation described in <em><a href="http://conal.net/blog/posts/higher-dimensional-higher-order-derivatives-functionally/" title="blog post">Higher-dimensional, higher-order derivatives, functionally</a></em> and in <em><a href="http://conal.net/blog/posts/simpler-more-efficient-functional-linear-maps/">Simpler, more efficient, functional linear maps</a></em>.  For the case of <em>R<sup>n</sup></em>, my formulation uses a trie with entries for <em>n</em> basis elements, while Jason&#8217;s uses an <code>IntMap</code> (which is also a trie) with <em>n</em> entries (counting any implicit zeros).</p></li>
</ul>

<p>I suspect Jason&#8217;s formulation is more efficient (since it optimizes the constant case), while mine is more statically typed and more flexible (since it handles more than <em>R<sup>n</sup></em>).</p>

<p>For optimizing constants, I think I&#8217;d prefer having a single constructor with a <code>Maybe</code> for the derivatives, to eliminate code duplication.</p>

<p>I am still trying to understand the paper <em><a href="http://www.bcl.hamilton.ie/~qobi/tower/papers/popl2007a.pdf" title="paper by Barak Pearlmutter and Jeffrey Siskind">Lazy Multivariate Higher-Order Forward-Mode AD</a></em>, with its management of various epsilons.</p>

<p>A final remark: I prefer the term &#8220;higher-dimensional&#8221; over the traditional &#8220;multivariate&#8221;.
I hear classic syntax/semantics confusion in the latter.</p>

<!--
**Edits**:

* 2008-02-09: just fiddling around
-->
<p><a href="http://conal.net/blog/?flattrss_redirect&amp;id=77&amp;md5=b3c10818ce32ef5eab99aec62217d345"><img src="http://conal.net/blog/wp-content/plugins/flattr/img/flattr-badge-white.png" srcset="http://conal.net/blog/wp-content/plugins/flattr/img/flattr-badge-white.png, http://conal.net/blog/wp-content/plugins/flattr/img/flattr-badge-white@2x.png 2xhttp://conal.net/blog/wp-content/plugins/flattr/img/flattr-badge-white.png, http://conal.net/blog/wp-content/plugins/flattr/img/flattr-badge-white@3x.png 3x" alt="Flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://conal.net/blog/posts/comparing-formulations-of-higher-dimensional-higher-order-derivatives/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=conal&amp;popout=1&amp;url=http%3A%2F%2Fconal.net%2Fblog%2Fposts%2Fcomparing-formulations-of-higher-dimensional-higher-order-derivatives&amp;language=en_GB&amp;category=text&amp;title=Comparing+formulations+of+higher-dimensional%2C+higher-order+derivatives&amp;description=I+just+reread+Jason+Foutz%26%238217%3Bs+post+Higher+order+multivariate+automatic+differentiation+in+Haskell%2C+as+I%26%238217%3Bm+thinking+about+this+topic+again.+I+like+his+trick+of+using+an+IntMap+to+hold...&amp;tags=comparison%2Cderivative%2Clinear+map%2Cmath%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>
