<?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>michaelgalloy.com</title>
	<atom:link href="http://michaelgalloy.com/feed" rel="self" type="application/rss+xml" />
	<link>http://michaelgalloy.com</link>
	<description>Resources for IDL developers</description>
	<lastBuildDate>Mon, 06 Feb 2012 20:16:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Object graphics to the web</title>
		<link>http://michaelgalloy.com/2012/02/06/object-graphics-to-the-web.html</link>
		<comments>http://michaelgalloy.com/2012/02/06/object-graphics-to-the-web.html#comments</comments>
		<pubDate>Mon, 06 Feb 2012 20:16:05 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[Object graphics]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3701</guid>
		<description><![CDATA[I&#8217;m not sure if I have mentioned this before, but I have a method of exporting simple object graphics scenes to a web page using x3dom. Check out this example of sending a graphics hierarchy containing a polygon (the cow data set from the IDL distribution) to an interactive display on a web page. This [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure if I have mentioned this before, but I have a method of exporting simple object graphics scenes to a web page using <a href="http://x3dom.org" title="x3dom - Home">x3dom</a>. Check out this example of sending a graphics hierarchy containing a polygon (the cow data set from the IDL distribution) to an <a href="http://michaelgalloy.com/wp-content/uploads/2011/09/cow.html" title="x3dom example">interactive display</a> on a web page.</p>

<p>This is currently a proof of concept and works for views, models, and polygons with simple properties only, but expanding to more classes and properties should be straightforward. I have done similar things for various other new destination classes for outputs such as <a href="http://michaelgalloy.com/2009/02/20/pov-ray-destination-v02.html" title="POV-Ray destination 0.2">POV-Ray</a> and <a href="http://michaelgalloy.com/2006/06/16/anaglyphs-mggr3dconverter-and-mggrwindow3d.html" title="Anaglyphs: MGgr3DConverter and MGgrWindow3D">anaglyphs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2012/02/06/object-graphics-to-the-web.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Evaluating mathematical expressions without EXECUTE</title>
		<link>http://michaelgalloy.com/2012/01/24/evaluating-mathematical-expressions-without-evaluate.html</link>
		<comments>http://michaelgalloy.com/2012/01/24/evaluating-mathematical-expressions-without-evaluate.html#comments</comments>
		<pubDate>Wed, 25 Jan 2012 00:33:01 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3680</guid>
		<description><![CDATA[Sometimes it is useful to evaluate a mathematical expression that is defined by the user at runtime. This is pretty easy to do using the EXECUTE routine, but EXECUTE is not allowed in applications running in the Virtual Machine. What to do? This issue has been a problem for me before so I wrote a [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it is useful to evaluate a mathematical expression that is defined by the user at runtime. This is pretty easy to do using the <code>EXECUTE</code> routine, but <code>EXECUTE</code> is not allowed in applications running in the Virtual Machine. What to do?</p>

<p>This issue has been a problem for me before so I wrote a <a href="http://docs.idldev.com/idllib/analysis/mg_evalexpr.pro" title="MG_EVALEXPR source">simple arithmetic parser</a> (<a href="http://docs.idldev.com/idllib/analysis/mg_evalexpr.html" title="MG_EVALEXPR docs">docs</a>).</p>

<p>Evaluates a mathematical expression using the basic arithmetic operators <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, and <code>^</code> along with parentheses for grouping and simple function calls of a single variable.</p>

<p>This routine is implemented with a recursive descent parser and does not use <code>EXECUTE</code>, so it is safe to use in the Virtual Machine.</p>

<p>For example, simple arithmetic expressions can be evaluated:</p>

<pre><code>IDL&gt; print, mg_evalexpr('1 + 2 + 3', error=error), error
                     6       0
</code></pre>

<p>Note that the <code>ERROR</code> keyword returns whether there was an error in  evaluating the expression. Expressions can also take variables, if their values are provided via a structure or hash-like object:</p>

<pre><code>IDL&gt; print, mg_evalexpr('exp(i * pi)', { pi: !dpi, i: complex(0, 1) })
(      -1.0000000,   1.2246468e-16)
</code></pre>

<p>&#8220;Hash-like&#8221; here means that the object implements a <code>hasKey</code> method and subscripting via brackets like the IDL 8.0 <code>Hash</code> class.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2012/01/24/evaluating-mathematical-expressions-without-evaluate.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IDLdoc 3.4.3 released</title>
		<link>http://michaelgalloy.com/2012/01/07/idldoc-3-4-3-released.html</link>
		<comments>http://michaelgalloy.com/2012/01/07/idldoc-3-4-3-released.html#comments</comments>
		<pubDate>Sat, 07 Jan 2012 15:50:17 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[IDLdoc]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3667</guid>
		<description><![CDATA[IDLdoc 3.4.3 fixes the bug that prevented search results from being displayed.]]></description>
			<content:encoded><![CDATA[<p><a href="http://idldoc.idldev.com/wiki/Downloads" title="IDLdoc downloads">IDLdoc 3.4.3</a> fixes the bug that prevented search results from being displayed.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2012/01/07/idldoc-3-4-3-released.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Computational science on StackExchange</title>
		<link>http://michaelgalloy.com/2011/12/13/computational-science-on-stackexchange.html</link>
		<comments>http://michaelgalloy.com/2011/12/13/computational-science-on-stackexchange.html#comments</comments>
		<pubDate>Tue, 13 Dec 2011 23:46:03 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[HPC]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3651</guid>
		<description><![CDATA[StackExchange, a network of collaborative question and answer sites, has opened a new site for computational science. Some questions on the site now: Is it possible to dynamically resize a sparse matrix in the Petsc library? Future of OpenCL? Parallel I/O options, in particular parallel HDF5 Is it worthwhile to write unit tests for scientific [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://stackexchange.com/" title="StackExchange">StackExchange</a>, a network of collaborative question and answer sites, has opened a new site for <a href="http://scicomp.stackexchange.com/" title="HPC on StackExchange">computational science</a>. Some questions on the site now:</p>

<ol>
<li>Is it possible to dynamically resize a sparse matrix in the Petsc library?</li>
<li>Future of OpenCL?</li>
<li>Parallel I/O options, in particular parallel HDF5</li>
<li>Is it worthwhile to write unit tests for scientific research codes?</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/12/13/computational-science-on-stackexchange.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IDLdoc 3.4.2 release</title>
		<link>http://michaelgalloy.com/2011/12/12/idldoc-3-4-2-release.html</link>
		<comments>http://michaelgalloy.com/2011/12/12/idldoc-3-4-2-release.html#comments</comments>
		<pubDate>Mon, 12 Dec 2011 23:00:34 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[IDLdoc]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3655</guid>
		<description><![CDATA[The new IDLdoc 3.4.2 release changes one small aspect of the .sav file in the distribution (the source distribution is example the same as the 3.4.1 release): it removes the IDL library routines from the .sav file, i.e., it doesn&#8217;t do a RESOLVE_ALL when constructing the .sav file. Currently, IDLdoc is built with IDL 6.4 [...]]]></description>
			<content:encoded><![CDATA[<p>The new <a href="http://idldoc.idldev.com/wiki/Downloads" title="IDLdoc downloads">IDLdoc 3.4.2 release</a> changes one small aspect of the <code>.sav</code> file in the distribution (the source distribution is example the same as the 3.4.1 release): it removes the IDL library routines from the <code>.sav</code> file, i.e., it doesn&#8217;t do a <code>RESOLVE_ALL</code> when constructing the <code>.sav</code> file.</p>

<p>Currently, IDLdoc is built with IDL 6.4 to maximize who can use it, but this means any included IDL library routines could conflict with the routines provided by the user&#8217;s IDL distribution. IDLdoc is intended to be run from the command line, i.e., a full version of IDL, not a runtime or VM environment, so the IDL library routines should be provided by the user&#8217;s IDL distribution.</p>

<p>Get the new version <a href="http://idldoc.idldev.com/wiki/Downloads" title="IDLdoc downloads">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/12/12/idldoc-3-4-2-release.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coyote graphics docs</title>
		<link>http://michaelgalloy.com/2011/12/12/coyote-graphics-docs.html</link>
		<comments>http://michaelgalloy.com/2011/12/12/coyote-graphics-docs.html#comments</comments>
		<pubDate>Mon, 12 Dec 2011 19:39:51 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[IDLdoc]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3640</guid>
		<description><![CDATA[David Fanning recently used IDLdoc to generate documentation for his Coyote Graphics library: On-line documentation is now available for all 41 of the Coyote Graphics programs. (These are a subset of the programs in the Coyote Library.) This will make it much easier to use these Coyote Graphics programs.]]></description>
			<content:encoded><![CDATA[<p>David Fanning recently used IDLdoc to generate <a href="http://www.idlcoyote.com/idldoc/cg/index.html" title="Coyote graphics documentation">documentation</a> for his Coyote Graphics library:</p>

<blockquote>
  <p>On-line documentation is now available for all 41 of the Coyote Graphics programs. (These are a subset of the programs in the Coyote Library.) This will make it much easier to use these Coyote Graphics programs.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/12/12/coyote-graphics-docs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IDLdoc 3.4.1 released</title>
		<link>http://michaelgalloy.com/2011/11/29/idldoc-3-4-1-released.html</link>
		<comments>http://michaelgalloy.com/2011/11/29/idldoc-3-4-1-released.html#comments</comments>
		<pubDate>Tue, 29 Nov 2011 18:07:36 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[IDLdoc]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3633</guid>
		<description><![CDATA[There was a bug in IDLdoc 3.4 which caused crashes with certain content in the Requires tag. The fix is in IDLdoc 3.4.1, get it here. Also, I have confirmation that IDLdoc will run on big libraries, i.e., over 4000 files, 7700 routines, and 850,000 lines of code!]]></description>
			<content:encoded><![CDATA[<p>There was a bug in IDLdoc 3.4 which caused crashes with certain content in the <code>Requires</code> tag. The fix is in IDLdoc 3.4.1, get it <a href="http://idldoc.idldev.com/wiki/Downloads">here</a>.</p>

<p>Also, I have confirmation that IDLdoc will run on <em>big</em> libraries, i.e., over 4000 files, 7700 routines, and 850,000 lines of code!</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/11/29/idldoc-3-4-1-released.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tech-X at AGU</title>
		<link>http://michaelgalloy.com/2011/11/28/tech-x-at-agu.html</link>
		<comments>http://michaelgalloy.com/2011/11/28/tech-x-at-agu.html#comments</comments>
		<pubDate>Mon, 28 Nov 2011 21:23:37 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3604</guid>
		<description><![CDATA[I will be AGU next week (Tuesday through Thursday morning). I&#8217;ll be hanging out at the Tech-X booth (circled at right, just up from the NASA booth) most of the time, but will also be patrolling the posters and hitting a few talks as well. Here&#8217;s our press release: Tech-X Corporation invites you to visit [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://michaelgalloy.com/wp-content/uploads/2011/11/techx-booth.png" align="right" hspace="8"/> I will be AGU next week (Tuesday through Thursday morning). I&#8217;ll be hanging out at the Tech-X booth (circled at right, just up from the NASA booth) most of the time, but will also be patrolling the posters and hitting a few talks as well.</p>

<p>Here&#8217;s our press release:</p>

<blockquote>
  <p>Tech-X Corporation invites you to visit our booth (Booth #1748) at the <a href="http://sites.agu.org/fallmeeting/" title="AGU Fall Meeting">American Geophysical Union Fall Meeting 2011</a>, December 5 &#8211; 9, at the Moscone Center in San Francisco.</p>
  
  <p>We will be featuring GPU Computing, including GPULib, our library of mathematical kernels for GPU computing.</p>
  
  <p>We will also be demonstrating the Remote Data Toolkit, which allows seamless access to remote data with IDL.</p>
  
  <p>Personnel from Tech-X and/or their collaborators will be participating in the following activities:</p>
  
  <p>Session A53C:  Multisensor and Model Aerosol Data Inter-comparison and Synergy III Posters 
  Friday, December 09  1:40PM &#8211; 6:00PM, Halls A &#8211; C</p>
  
  <p>A53C-0382 Aerosol type estimations for the ERBE period (1985 &#8211; 1989) Jose R. Fernandez, SSAI, Hampton, VA; Seiji Kato, NASA Langley Research Center, Hampton, VA; Fred G. Rose, SSAI, Hampton, VA; David W. Fillmore, Tech-X Corporation, Boulder, CO</p>
</blockquote>

<p>Exelis VIS will be at booth #1431; I haven&#8217;t heard about if there will be an IDL user group meeting.</p>

<p>UPDATE: Also, if you have an iPhone, I recommend the <a href="http://itunes.apple.com/us/app/american-geophysical-union/id476096198?mt=8">AGU app</a>. It has been very useful already for me.</p>

<p><em>Full disclosure: I work for Tech-X Corporation.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/11/28/tech-x-at-agu.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IDLdoc 3.4 released</title>
		<link>http://michaelgalloy.com/2011/11/21/idldoc-3-4-released.html</link>
		<comments>http://michaelgalloy.com/2011/11/21/idldoc-3-4-released.html#comments</comments>
		<pubDate>Mon, 21 Nov 2011 21:52:12 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[IDLdoc]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3589</guid>
		<description><![CDATA[IDLdoc 3.4 was released today. This is mostly a bug fix version, but there is on big feature: LaTeX equation formatting. To use LaTeX equations in your docs, just use standard LaTeX syntax anywhere plain text is allowed. For example, here is an example of using an equation in the main description: ;+ ; Inverse [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://idldoc.idldev.com/wiki/Downloads" title="IDLdoc downloads">IDLdoc 3.4</a> was released today. This is mostly a bug fix version, but there is on big feature: LaTeX equation formatting. To use LaTeX equations in your docs, just use standard LaTeX syntax anywhere plain text is allowed. For example, here is an example of using an equation in the main description:</p>

<pre><code>;+
; Inverse hyperbolic cosine. Uses the formula:
;
; $$\text{acosh}(z) = \ln(z + \sqrt{z + 1} \sqrt{z - 1})$$
;
; :Returns:
;    float, double, complex, or double complex depending on the input
;
; :Params:
;    z : in, required, type=numeric
;       input
;-
</code></pre>

<p>The equation should be typeset like (results depend on browser):</p>

<p>$$\text{acosh}(z) = \ln(z + \sqrt{z + 1} \sqrt{z &#8211; 1})$$</p>

<p>Inline equations are also allowed. Both can appear in the main description and inside most tags (anywhere comments are just copied over to the output).</p>

<p>Here are the full release notes:</p>

<ol>
<li>Allow LaTeX equation formatting.</li>
<li>Fix for bug where links to routines, files, etc. in directory overview 
comments on the overview page were not correct.</li>
<li>Adding links to parent items in index entries.</li>
<li>Changes to HTML output styling including larger type size.</li>
<li>Fixed bug where DLM contents could not be references using backtick notation
in rst markup syntax.</li>
<li>Added private and hidden attributes to directory names in overview file.</li>
<li>Not showing warnings page when USER keyword is set.</li>
<li>Fixed bug where parsing rst Requires tag would cause IDLdoc to crash.</li>
<li>Fixed bug where Warnings page showed items from private or hidden items.</li>
<li>UPDATED 11/22: New color scheme.</li>
</ol>

<p>[<a href="http://idldoc.idldev.com/wiki/Downloads" title="IDLdoc downloads">Download</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/11/21/idldoc-3-4-released.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Logging</title>
		<link>http://michaelgalloy.com/2011/11/17/logging.html</link>
		<comments>http://michaelgalloy.com/2011/11/17/logging.html#comments</comments>
		<pubDate>Thu, 17 Nov 2011 19:36:56 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3559</guid>
		<description><![CDATA[When writing applications or even just longer programs, I used to sprinkle in PRINT statements regularly, telling me of the progress of the program. At some point, I would think the program is working correctly and I would then have to search through the code to find all the PRINT statements to either comment them [...]]]></description>
			<content:encoded><![CDATA[<p>When writing applications or even just longer programs, I used to sprinkle in <code>PRINT</code> statements regularly, telling me of the progress of the program. At some point, I would think the program is working correctly and I would then have to search through the code to find all the <code>PRINT</code> statements to either comment them out (smart, but leaves ugly code behind) or delete them (dumb, I would eventually need them again when I discovered some problem). This approach has some definite drawbacks:</p>

<ol>
<li>there is no easy way to turn the complete output on and off, much less on a more granular level</li>
<li>output goes to the output log, but sometimes it would be nicer to send the output to a log file</li>
<li><code>PRINT</code> provides little help for things that I commonly need to print like the time/date, the routine that the message is originating from, etc.</li>
</ol>

<p>I&#8217;ve created the <code>MG_LOG</code> routine to help with these problems.</p>

<p><span id="more-3559"></span></p>

<p>At it&#8217;s most basic <code>MG_LOG</code> just prints out a message that you provide:</p>

<pre><code>IDL&gt; mg_log, 'Hello'
2011-11-17 11:41:44.000 DEBUG: $MAIN$: Hello
</code></pre>

<p>There are five priority levels of messages; in decreasing priority they are:</p>

<ol>
<li>critical</li>
<li>error</li>
<li>warning</li>
<li>informational</li>
<li>debug</li>
</ol>

<p>The default is a &#8220;debug&#8221;-level message, but we can set that when we provide a message:</p>

<pre><code>IDL&gt; mg_log, 'Hello', /informational
2011-11-17 11:45:28.000 INFORMATIONAL: $MAIN$: Hello
</code></pre>

<p>We can also configure the logger to only show messages of a certain level or higher:</p>

<pre><code>IDL&gt; mg_log, level=3
IDL&gt; mg_log, 'Hello', /informational   ;note no output because 2 &lt; 3
IDL&gt; mg_log, 'Hello', /warning
2011-11-17 11:46:55.000 WARNING: $MAIN$: Hello
</code></pre>

<p>This solves problem #1 above, you only need to set the level in one location in your program, e.g., on startup. Setting the level to <code>0</code> turns off all messages, further granularity is provided by the other levels. Even more granularity is provided by named loggers which are organized into hierarchies and can be individually configured, but I&#8217;m not going to go into detail about those right now.</p>

<p>Output can also be redirected to files when the logger is configured:</p>

<pre><code>IDL&gt; mg_log, level=3, filename='myapp.log'
IDL&gt; mg_log, 'Hello', /critical
</code></pre>

<p>Now look at the contents of <code>myapp.log</code>:</p>

<pre><code>IDL&gt; $cat myapp.log
2011-11-17 11:52:26.000 CRITICAL: $MAIN$: Hello
</code></pre>

<p>The file is opened and closed between each writing, so you don&#8217;t have to worry about the log file not being up-to-date. This solves problem #2.</p>

<p>For problem #3, <code>MG_LOG</code> also provides a <code>FORMAT</code> keyword that gives a few variables that can be inserted automatically into the log message. For example, let&#8217;s set the <code>FILENAME</code> to a null string so that output goes to the output log again and try a new log message format:</p>

<pre><code>IDL&gt; mg_log, format='%(levelname)s: %(message)s', filename=''
IDL&gt; mg_log, 'Hello', /critical, filename=''
CRITICAL: Hello
</code></pre>

<p>The default log message format is:</p>

<pre><code>%(time)s %(levelname)s: %(routine)s: %(message)s
</code></pre>

<p>The <code>FORMAT</code> keyword uses a special syntax to substitute a selection of predefined variables (&#8220;time&#8221;, &#8220;levelname&#8221;, &#8220;routine&#8221;, &#8220;message&#8221;, &#8220;stacktrace&#8221;, and &#8220;name&#8221;) into the log message.</p>

<p>In the course of writing the logging framework I had to write a routine, <code>MG_SUBS</code>, that performs substitution of variables into a string by name. I wanted to make this routine as usable for general use as possible, so we get a very flexible formatting syntax. It uses the C format codes with the addition of a name in parenthesis between the <code>%</code> and the rest of the format code indicating which variable should get substituted into that format code. For example, this can be used by itself like:</p>

<pre><code>IDL&gt; print, mg_subs('%(loc)s temp: %(temp)0.1f F', $
IDL&gt;                {loc: 'Boulder', temp: 65.})
Boulder temp: 65.0 F
</code></pre>

<p>This allows the variables to be provided in any order, to be used twice in the format, and to even provide variables that are not used in the format.</p>

<p>There is also a <code>TIME_FORMAT</code> keyword to further specify the format of the &#8220;time&#8221; variable in the <code>FORMAT</code> property. It uses Fortran-style format codes since there are no C-style calendar format codes. The default time format is:</p>

<pre><code>C(CYI4.4,"-",CMOI2.2,"-",CDI2.2," ",CHI2.2,":",CMI2.2,":",CSF06.3)
</code></pre>

<p>Together <code>FORMAT</code> and <code>TIME_FORMAT</code> provide a lot of control and flexibility in the log message format.</p>

<p>To get the code for the logging framework (and <code>MG_SUBS</code>), grab the <code>dist_tools</code> package with Subversion:</p>

<pre><code>svn co http://svn.idldev.com/dist_tools/trunk dist_tools
</code></pre>

<p>Let me know if this is useful to you or you have problems/requests!</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/11/17/logging.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Modern IDL 1.1 update</title>
		<link>http://michaelgalloy.com/2011/10/18/modern-idl-1-1-update.html</link>
		<comments>http://michaelgalloy.com/2011/10/18/modern-idl-1-1-update.html#comments</comments>
		<pubDate>Tue, 18 Oct 2011 22:34:27 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[IDL]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3516</guid>
		<description><![CDATA[I&#8217;ve updated Modern IDL for some of the IDL 8.1 features, notably GRIB, function graphics enhancements1, and the IDLffVideoWrite class. PDF purchasers from this point on should get the new version and I will send out the update to the purchasers of the old PDF shortly. The first run of the print book is all [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated <em>Modern IDL</em> for some of the IDL 8.1 features, notably GRIB, function graphics enhancements<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>, and the <code>IDLffVideoWrite</code> class. PDF purchasers from this point on should get the new version and I will send out the update to the purchasers of the old PDF shortly. The first run of the print book is all sold; the second run is still at the printers. So if you order the print version right now, expect the book to ship sometime next week.</p>

<p>As always, see the <a href="http://modernidl.idldev.com" title="Modern IDL website">Modern IDL website</a> for purchasing, new code examples, table of contents, sample chapter (object graphics with the new function graphics updates!), and errata.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>Also, I switch back to the term &#8220;function graphics&#8221;, which was my original favorite term for the new graphics system, but I had gone away from it because there seemed to be consensus on the newsgroup to call it &#8220;new graphics.&#8221; I think &#8220;function graphics&#8221; is a better term that is less likely to not make sense when the next graphics system comes out.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/10/18/modern-idl-1-1-update.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Set operations on non-negative integers</title>
		<link>http://michaelgalloy.com/2011/10/12/set-operations-on-non-negative-integers.html</link>
		<comments>http://michaelgalloy.com/2011/10/12/set-operations-on-non-negative-integers.html#comments</comments>
		<pubDate>Wed, 12 Oct 2011 18:55:25 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3501</guid>
		<description><![CDATA[Arrays of non-negative integers are encountered frequently in IDL, e.g., for index arrays and lists of ENVI file IDs to name a couple examples. Since valid data elements are non-negative integers, -1 is used to indicate an empty set. I have a few routines for efficiently computing set unions, intersections, differences, and complements. For example, [...]]]></description>
			<content:encoded><![CDATA[<p>Arrays of non-negative integers are encountered frequently in IDL, e.g., for index arrays and lists of ENVI file IDs to name a couple examples. Since valid data elements are non-negative integers, <code>-1</code> is used to indicate an empty set. I have a few routines for efficiently computing set unions, intersections, differences, and complements.</p>

<p>For example, suppose I have found the valid data in an image with:</p>

<pre><code>IDL&gt; valid_ind = where(band gt 0.)
</code></pre>

<p>And then I find indices of the clouds in the image using my special routine <code>FIND_CLOUD_INDICES</code>:</p>

<pre><code>IDL&gt; noncloud_ind = find_cloud_indices(band)
</code></pre>

<p>Now, if I want to find the indices of the pixels of the image that are valid <em>and</em> not cloud pixels, I can use my <code>MG_SETINTERSECTION</code> routine:</p>

<pre><code>IDL&gt; valid_ind = mg_setintersection(valid_ind, noncloud_ind)
</code></pre>

<p>Download the <a href="http://michaelgalloy.com/wp-content/uploads/2011/10/setoperations.zip" title="Set operations files">routines</a> or look at the <a href="http://docs.idldev.com/idllib/indices/dir-overview.html" title="Set operations docs">documentation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/10/12/set-operations-on-non-negative-integers.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Combining testing methods</title>
		<link>http://michaelgalloy.com/2011/10/11/combining-testing-methods.html</link>
		<comments>http://michaelgalloy.com/2011/10/11/combining-testing-methods.html#comments</comments>
		<pubDate>Tue, 11 Oct 2011 17:12:52 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[mgunit]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3490</guid>
		<description><![CDATA[Finding severe bugs after a release is 100 more expensive than before (2x for non-critical bugs), so how can more bugs be found before release? This article suggests combining multiple testing/review methods, particularly adding code review: More generally, inspections are a cheaper method of finding bugs than testing; according to Basili and Selby (1987), code [...]]]></description>
			<content:encoded><![CDATA[<p>Finding severe bugs after a release is 100 more expensive than before (2x for non-critical bugs), so how can more bugs be found before release? This <a href="http://kev.inburke.com/kevin/the-best-ways-to-find-bugs-in-your-code/" title="The best ways to find bugs in your code">article</a> suggests combining multiple testing/review methods, particularly adding code review:</p>

<blockquote>
  <p>More generally, inspections are a cheaper method of finding bugs than testing; according to Basili and Selby (1987), code reading detected 80 percent more faults per hour than testing, even when testing programmers on code that contained zero comments.</p>
</blockquote>

<p>So grab <a href="http://mgunit.idldev.com" title="mgunit Trac site">mgunit</a> and write some unit/regression/system tests; get a friend and have her look over your code; have a beta test period; etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/10/11/combining-testing-methods.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The IDL Data Point</title>
		<link>http://michaelgalloy.com/2011/09/22/the-idl-data-point.html</link>
		<comments>http://michaelgalloy.com/2011/09/22/the-idl-data-point.html#comments</comments>
		<pubDate>Thu, 22 Sep 2011 16:34:52 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3474</guid>
		<description><![CDATA[The IDL Data Point is a new IDL site written by ITT VIS engineer Mark Piper. It promises to &#8220;provide technical, programmatic examples of using IDL&#8221; including &#8220;information and examples on topics where there’s a lack, like using IDL 8 (aka New) Graphics and the IDL workbench&#8221;. There is already an article about the new [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://idldatapoint.com/">The IDL Data Point</a> is a new IDL site written by ITT VIS engineer Mark Piper. It promises to &#8220;provide technical, programmatic examples of using IDL&#8221; including &#8220;information and examples on topics where there’s a lack, like using IDL 8 (aka New) Graphics and the IDL workbench&#8221;. There is already an <a href="http://idldatapoint.com/2011/09/22/grib-helper-routines/">article</a> about the new GRIB routines, including helper routines to make accessing GRIB routines easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/09/22/the-idl-data-point.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Modern IDL 1.0.1</title>
		<link>http://michaelgalloy.com/2011/08/26/modern-idl-1-0-1.html</link>
		<comments>http://michaelgalloy.com/2011/08/26/modern-idl-1-0-1.html#comments</comments>
		<pubDate>Fri, 26 Aug 2011 19:26:43 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[IDL]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3464</guid>
		<description><![CDATA[I&#8217;ve updated the PDF version of Modern IDL to fix some typos. If you bought a copy of the PDF, you should receive an email this weekend (to the email address used to buy the book) with instructions on downloading the new PDF. I&#8217;ve included an omitted program from the example programs also, so follow [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated the PDF version of <a href="http://modernidl.idldev.com">Modern IDL</a> to fix some typos. If you bought a copy of the PDF, you should receive an email this weekend (to the email address used to buy the book) with instructions on downloading the new PDF. I&#8217;ve included an omitted program from the example programs also, so follow the correct download link at <a href="http://modernidl.idldev.com">Modern IDL</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/08/26/modern-idl-1-0-1.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GPU computing training course</title>
		<link>http://michaelgalloy.com/2011/07/27/gpu-computing-training-course-2.html</link>
		<comments>http://michaelgalloy.com/2011/07/27/gpu-computing-training-course-2.html#comments</comments>
		<pubDate>Wed, 27 Jul 2011 18:21:38 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[HPC]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3455</guid>
		<description><![CDATA[We&#8217;re offering another training course on GPU programming this fall: Tech-X Corporation is pleased to announce our next three-day training course for GPU computing with CUDA will be held from September 19 &#8211; 21 at our offices in Boulder, Colorado, USA. If you are interested, please complete the form so we can contact you with [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re offering another training course on GPU programming this fall:</p>

<blockquote>
  <p>Tech-X Corporation is pleased to announce our next three-day training course
  for GPU computing with CUDA will be held from September 19 &#8211; 21 at our
  offices in Boulder, Colorado, USA.  If you are interested, please complete
  the <a href="http://www.txcorp.com/products/GPULib/cuda_training/download.php">form</a>
  so we can contact you with further details.</p>
  
  <p>The cost for this particular training will be US$1,200 for all three days.
  This price includes lunch each day.  You can register and pay at <a href="http://www.txcorp.com/catalog/index.php">our online
  store</a>.</p>
</blockquote>

<p><em>Full disclosure: I work for Tech-X Corporation.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/07/27/gpu-computing-training-course-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X 10.7 Lion</title>
		<link>http://michaelgalloy.com/2011/07/26/mac-os-x-10-7-lion.html</link>
		<comments>http://michaelgalloy.com/2011/07/26/mac-os-x-10-7-lion.html#comments</comments>
		<pubDate>Tue, 26 Jul 2011 20:46:30 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[IDL]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3431</guid>
		<description><![CDATA[The newest Mac OS, Mac OS X 10.7 Lion, was released last week. See John Siracusa&#8217;s review for a extremely detailed look at the new features in Lion. AstroBetter posted some thoughts on Mac OS X 10.7 Lion along with a comment thread from users about how it has affected specific astronomy packages. My thoughts [...]]]></description>
			<content:encoded><![CDATA[<p>The newest Mac OS, Mac OS X 10.7 Lion, was released last week. See <a href="http://arstechnica.com/apple/reviews/2011/07/mac-os-x-10-7.ars">John Siracusa&#8217;s review</a> for a extremely detailed look at the new features in Lion. AstroBetter posted some <a href="http://www.astrobetter.com/os-x-lion-install/">thoughts on Mac OS X 10.7 Lion</a> along with a comment thread from users about how it has affected specific astronomy packages.</p>

<p>My thoughts from using Lion for a few days on my home computer (I haven&#8217;t upgraded work computers yet):</p>

<ol>
<li>IDL seems to work fine, though I haven&#8217;t done much on my home computer besides a few sanity tests.</li>
<li>Lion is the first Mac OS X update I have thought felt slower than its predecessor. I think it is mostly due to the new <a href="http://arstechnica.com/apple/reviews/2011/07/mac-os-x-10-7.ars/4#animation">window creation animation</a>. The extremely useful Secrets website <a href="http://secrets.blacktree.com/edit?id=178761">says</a> that the following should turn off the animation: &#8220;<code>defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO</code>&#8220;.</li>
<li>Spaces have been changed a bit to work with the new Mission Control feature. I had a 2 x 3 grid of spaces previously, but Lion only supports a 1-dimensional array of spaces, so now I have a single row of six spaces. This is what I&#8217;m missing the most so far, since my 2-dimensional mental model of the purposes of the spaces allowed quick switching between tasks.</li>
<li><a href="http://arstechnica.com/apple/reviews/2011/07/mac-os-x-10-7.ars/3#scroll-bar">Scrolling</a> is, by default, backwards from the current direction, but there is a preference value to change it back to the Snow Leopard way. I suppose if I had a Magic Trackpad I would give the new way a try, but I use a regular mouse with a scroll wheel, so I stuck to the old way.</li>
<li>Most people are reporting an easy installation from the Mac App Store, but I had some difficulty. After Lion was downloaded, my Mac rebooted and the installer hung. It reported that it had 33 minutes to go for several hours. I tried again and it appeared to hang again, but I left it going all day as I was at work. When I come back, it had installed. Not sure how long it took, but it was definitely way longer than 33 minutes. </li>
<li>Rosetta support is gone, luckily all my applications are native now.</li>
<li>The UI is generally more muted and fading into the background, which I really like. On the other hand, iCal and Address Book got the <a href="http://en.wikipedia.org/wiki/Skeuomorphic">skeuomorphic</a> treatment, which I really don&#8217;t like.</li>
<li>For a few months, the new version of XCode cost $5. The new Lion version is free again.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/07/26/mac-os-x-10-7-lion.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Modern IDL listed on ITT VIS site</title>
		<link>http://michaelgalloy.com/2011/07/22/modern-idl-listed-on-itt-vis-site.html</link>
		<comments>http://michaelgalloy.com/2011/07/22/modern-idl-listed-on-itt-vis-site.html#comments</comments>
		<pubDate>Fri, 22 Jul 2011 23:22:07 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[IDL]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3429</guid>
		<description><![CDATA[Modern IDL is now listed on the IDL books page on ITT VIS&#8217; site!]]></description>
			<content:encoded><![CDATA[<p>Modern IDL is now listed on the <a href="http://www.ittvis.com/language/en-US/Support/IDLBooks.aspx">IDL books page</a> on ITT VIS&#8217; site!</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/07/22/modern-idl-listed-on-itt-vis-site.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modern IDL review</title>
		<link>http://michaelgalloy.com/2011/07/19/modern-idl-review.html</link>
		<comments>http://michaelgalloy.com/2011/07/19/modern-idl-review.html#comments</comments>
		<pubDate>Tue, 19 Jul 2011 16:42:46 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[IDL]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3409</guid>
		<description><![CDATA[Lesa Williams, ITT VIS Programming Consultant, recently wrote a great review of Modern IDL for an internal ITT VIS newsletter. I had gotten word of the review last week, but today I received permission to post the whole review here: Mike Galloy spent nearly five years writing this 462-page book covering modern topics in IDL, [...]]]></description>
			<content:encoded><![CDATA[<p>Lesa Williams, ITT VIS Programming Consultant, recently wrote a great review of <em>Modern IDL</em> for an internal ITT VIS newsletter. I had gotten word of the review last week, but today I received permission to post the whole review here:</p>

<blockquote>
  <p>Mike Galloy spent nearly five years writing this 462-page book covering modern topics in IDL, and it certainly shows. This virtual tome (available in both PDF and spiral-bound versions) contains a wealth of information on the IDL programming language, with sections for beginners and advanced users alike. It provides a wide range of topics spanning from IDL basics such as variables, file input/output, programming calls, and direct graphics to more advanced concepts such as widget/object graphics applications, IDL compound widgets and composite graphic classes, optimizing code performance, and external development using bridges, Python, etc.</p>
  
  <p>One impressive aspect of Modern IDL is how well it illustrates some of the basic components of the IDL programming language from a fresh, unique perspective. Those with a chemistry or physics background will appreciate Galloy’s innovative way of viewing the IDL operator hierarchy via the &#8220;Periodic Table of IDL Operators.&#8221; Similarly, for those who are more literary in nature, there is an extensive section on strings and string manipulation, with an especially helpful segment on the often confusing, but very powerful, use of regular expressions. For visual learners, Modern IDL has an exemplary set of diagrams depicting the concept and use of pointer variables in IDL. The mathematically-minded will thoroughly enjoy the four-page section explaining the use of the <em>IDLgrModel</em>’s transformation matrix, as well as the seven-plus pages describing the simplistically beautiful, yet amazingly clever, <code>HISTOGRAM</code> function. Lastly, hard-core programmers will hone in on the chapter covering code performance in which Galloy addresses various ways to speed up and to make IDL code more computationally and memory efficient (e.g., taking advantage of IDL’s array operators, minimizing the number of interpreted statements, using IDL thread? aware operators/routines, etc.).</p>
  
  <p>Accompanying the wide array of material in the Modern IDL text itself are over 50 pages of additional resources and information contained within the appendices. The book is also filled with numerous exercises and examples, which makes it a very practical, hands-on instructional guide. In my opinion, Galloy has written an outstanding and comprehensive book covering a vast range of topics relevant to the current world of IDL programming. This is a terrific resource &mdash; one that I will definitely revisit time and time again.</p>
</blockquote>

<p>Thanks, I hope this is a great resource for IDL programmers! Check out <a href="http://modernidl.idldev.com"><em>Modern IDL</em>&#8216;s website</a> for sample chapter, table of contents, and links to buy.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/07/19/modern-idl-review.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DLM implementing Kahan summation</title>
		<link>http://michaelgalloy.com/2011/07/08/dlm-implementing-kahan-summation.html</link>
		<comments>http://michaelgalloy.com/2011/07/08/dlm-implementing-kahan-summation.html#comments</comments>
		<pubDate>Fri, 08 Jul 2011 19:06:30 +0000</pubDate>
		<dc:creator>Michael Galloy</dc:creator>
				<category><![CDATA[DLM]]></category>
		<category><![CDATA[IDL]]></category>
		<category><![CDATA[original]]></category>

		<guid isPermaLink="false">http://michaelgalloy.com/?p=3387</guid>
		<description><![CDATA[Based on discussion on the newsgroup today about the errors in summing large arrays, I implemented the Kahan summation algorithm as a routine in a DLM. Download, unzip, and build it with the following command: IDL&#62; mg_make_dll, 'mg_analysis.c', /show_all_output Don&#8217;t forget to put the directory with the DLM in your IDL_DLM_PATH. I thought it would [...]]]></description>
			<content:encoded><![CDATA[<p>Based on discussion on the newsgroup today about the errors in summing large arrays, I implemented the Kahan summation algorithm as a routine in a DLM. <a href="http://michaelgalloy.com/wp-content/uploads/2011/07/mg_analysis_dlm.zip">Download</a>, unzip, and build it with the following command:</p>

<pre><code>IDL&gt; mg_make_dll, 'mg_analysis.c', /show_all_output
</code></pre>

<p>Don&#8217;t forget to put the directory with the DLM in your <code>IDL_DLM_PATH</code>.</p>

<p>I thought it would be interesting because of the discussion in the newsgroup and the fact that it was pretty simple to make it work for all the different numeric data types IDL offers (for an example of when it is not so simple, check out the implementation of <code>MG_ARRAY_EQUAL</code> in the source code).</p>

<p><span id="more-3387"></span></p>

<p>The main algorithm is very simple, but complicated a bit by the fact that it is a C macro:</p>

<pre><code>#define IDL_MG_TOTAL_TYPE(TYPE, IDL_TYPE, INIT)        \
IDL_VPTR IDL_mg_total_ ## IDL_TYPE (IDL_VPTR arg) {    \
  TYPE sum = INIT, c = INIT, y = INIT, t = INIT;       \
  int i;                                               \
                                                       \
  TYPE *arr = (TYPE *)arg-&gt;value.arr-&gt;data;            \
                                                       \
  for (i = 0; i &lt; arg-&gt;value.arr-&gt;n_elts; i++) {       \
    y = arr[i] - c;                                    \
    t = sum + y;                                       \
    c = (t - sum) - y;                                 \
    sum = t;                                           \
  }                                                    \
  return(IDL_Gettmp ## IDL_TYPE (sum));                \
}
</code></pre>

<p>Ugly yes, but better than repeating the code nine times.</p>

<p>So this macro needs to be called for each of the supported data types to make the routines that handle each type:</p>

<pre><code>IDL_MG_TOTAL_TYPE(UCHAR, Byte, 0)
IDL_MG_TOTAL_TYPE(short int, Int, 0)
IDL_MG_TOTAL_TYPE(int, Long, 0)
IDL_MG_TOTAL_TYPE(float, Float, 0.0)
IDL_MG_TOTAL_TYPE(double, Double, 0.0)
IDL_MG_TOTAL_TYPE(IDL_UINT, UInt, 0)
IDL_MG_TOTAL_TYPE(IDL_ULONG, ULong, 0)
IDL_MG_TOTAL_TYPE(IDL_LONG64, Long64, 0)
IDL_MG_TOTAL_TYPE(IDL_ULONG64, ULong64, 0)
</code></pre>

<p>And then the master routine needs to call the appropriate routine for the input type (it always computes a result that is the same type as the input):</p>

<pre><code>IDL_VPTR IDL_mg_total(int argc, IDL_VPTR *argv, char *argk) {
  IDL_ENSURE_ARRAY(argv[0]);
  switch (argv[0]-&gt;type) {
    case IDL_TYP_BYTE:
      return(IDL_mg_total_Byte(argv[0]));
    case IDL_TYP_INT:
      return(IDL_mg_total_Int(argv[0]));
    case IDL_TYP_LONG:
      return(IDL_mg_total_Long(argv[0]));
    case IDL_TYP_FLOAT:
      return(IDL_mg_total_Float(argv[0]));
    case IDL_TYP_DOUBLE:
      return(IDL_mg_total_Double(argv[0]));
    case IDL_TYP_UINT:
      return(IDL_mg_total_UInt(argv[0]));
    case IDL_TYP_ULONG:
      return(IDL_mg_total_ULong(argv[0]));
    case IDL_TYP_LONG64:
      return(IDL_mg_total_Long64(argv[0]));
    case IDL_TYP_ULONG64:
      return(IDL_mg_total_ULong64(argv[0]));
    default:
      IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_LONGJMP, "unknown type");    
  }
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://michaelgalloy.com/2011/07/08/dlm-implementing-kahan-summation.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

