<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.6" -->
<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/"
	>

<channel>
	<title>quantlib.co.uk</title>
	<link>http://www.quantlib.co.uk/blog</link>
	<description>Life as a Quantitative Analyst</description>
	<pubDate>Thu, 07 Feb 2008 16:08:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.6</generator>
	<language>en</language>
			<item>
		<title>Yap error: Windows API error 5: Access is denied</title>
		<link>http://www.quantlib.co.uk/blog/yap-error-windows-api-error-5-access-is-denied</link>
		<comments>http://www.quantlib.co.uk/blog/yap-error-windows-api-error-5-access-is-denied#comments</comments>
		<pubDate>Thu, 07 Feb 2008 16:08:56 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Uncategorized</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/yap-error-windows-api-error-5-access-is-denied</guid>
		<description><![CDATA[If you are not an administrator on your own machine you may get an access violation error when using the Yap dvi viewer supplied with MikTex. The error is Windows API error 5: Access is denied. The happens because the user does not have write access to the MikTex directories. Right click on the directory, [...]]]></description>
			<content:encoded><![CDATA[<p>If you are not an administrator on your own machine you may get an access violation error when using the Yap dvi viewer supplied with MikTex. The error is Windows API error 5: Access is denied. The happens because the user does not have write access to the MikTex directories. Right click on the directory, say, C:\Apps\MiKTeX, and make the directory, and all subdirectories, read-write. This should solve the problem.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/yap-error-windows-api-error-5-access-is-denied/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What does NOMINMAX do?</title>
		<link>http://www.quantlib.co.uk/blog/what-does-nominmax-do</link>
		<comments>http://www.quantlib.co.uk/blog/what-does-nominmax-do#comments</comments>
		<pubDate>Wed, 06 Feb 2008 15:36:43 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/what-does-nominmax-do</guid>
		<description><![CDATA[When compiling in Microsoft Visual C++ you may come across the preprocessor directive NOMINMAX. This undefines the macros MIN and MAX which are specified in the windows headers. In Visual C++ v 6.0 this may be in C:\Program Files\Microsoft Visual Studio\VC98\Include\windef.h where we have
#ifndef NOMINMAX
#ifndef max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
#endif #ifndef min
#define [...]]]></description>
			<content:encoded><![CDATA[<p>When compiling in Microsoft Visual C++ you may come across the preprocessor directive NOMINMAX. This undefines the macros MIN and MAX which are specified in the windows headers. In Visual C++ v 6.0 this may be in C:\Program Files\Microsoft Visual Studio\VC98\Include\windef.h where we have</p>
<p><tt>#ifndef NOMINMAX</tt><br />
<tt>#ifndef max</tt><br />
<tt>#define max(a,b)            (((a) > (b)) ? (a) : (b))</tt><br />
<tt>#endif</tt> <tt>#ifndef min</tt><br />
<tt>#define min(a,b)            (((a) < (b)) ? (a) : (b))</tt><br />
<tt>#endif</tt><br />
<tt>#endif  /* NOMINMAX */</tt></p>
<p>Using macros to do this is a bad idea, as discussed <a href="http://www.faqs.org/docs/learnc/x843.html">here</a>. The standard library has templated functions std::min and std::max which are much better. Defining NOMINMAX before any #includes of windows.h prevents the macros from being defined and allows the use of the templated functions defined in algorithm.</p>
<p> 
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/what-does-nominmax-do/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Implementing a Build and Release Process</title>
		<link>http://www.quantlib.co.uk/blog/implementing-a-build-and-release-process</link>
		<comments>http://www.quantlib.co.uk/blog/implementing-a-build-and-release-process#comments</comments>
		<pubDate>Wed, 12 Dec 2007 22:37:38 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/implementing-a-build-and-release-process</guid>
		<description><![CDATA[Software development is iterative and incremental. Therefore a critical part of building a successful production system is the build and release process. The faster we can build, test, and release, the faster we can iterate through development landmarks. This is of no use if we are not sure that everything we have done before is [...]]]></description>
			<content:encoded><![CDATA[<p>Software development is iterative and incremental. Therefore a critical part of building a successful production system is the build and release process. The faster we can build, test, and release, the faster we can iterate through development landmarks. This is of no use if we are not sure that everything we have done before is still working as required, which is enforced through test-driven development with automated testing.<a id="more-17"></a></p>
<p><strong>Source Control</strong></p>
<p>All library code has to be safely stored and <a href="http://en.wikipedia.org/wiki/Revision_control">versioned</a>. Using a professional source control system is essential. This enables particular snapshots of the code to be labelled, or versioned, which is required for patch releases for fixing bugs, and for returning to a known previous version. A properly supported source control process will also ensure all work is backed up regularly.</p>
<p>Particular source control systems include packages such as Microsoft Visual Source Safe (to be replaced by Microsoft Visual Studio Team Foundation Server), <a href="http://subversion.tigris.org/">Subversion</a>, <a href="http://www.quantlib.co.uk/blog/en.wikipedia.org/wiki/Concurrent\_Versions\_System">CVS</a>, <a href="http://www.ibm.com/software/awdtools/clearcase/">Clearcase</a> and <a href="http://www.perforce.com/">Perforce</a>. These systems vary in their scalability, and ability to work across multiple geographic locations.</p>
<p><strong>Build</strong></p>
<p>An automated build and test system will improve code quality and reliability greatly. A tool such as <a href="http://www.quantlib.co.uk/blog/cruisecontrol.sourceforge.net">Cruise Control</a> can be configured to automatically check out the code from source control, build it, test it, and deploy it. Cruise Control can call a build tool such as <a href="http://www.quantlib.co.uk/blog/ant.apache.org">Ant</a>, <a href="http://www.quantlib.co.uk/blog/nant.sourceforge.net/">Nant</a>, <a href="http://www.gnu.org/software/make/">Make</a> or <a href="http://en.wikipedia.org/wiki/MSBuild">MSBuild</a>.</p>
<p>A proven set-up is to do a full build (including tests), having deleted all intermediate files and directories, once a day, overnight. Then, during the day an incremental build can be done every hour, or when some code has been checked in. If the build, or a test, fails then emails are sent to the developers immediately, and the problem quickly rectified.</p>
<p>It must be possible to build and run the library both in debug and release. Care must be taken to ensure that tests pass in both debug and release. However, debug can be too slow to test some numerical problems.</p>
<p><strong>Configuration</strong></p>
<p>It is extremely useful to be able to update configuration dynamically, without recompiling. There is no need to recompile the code just to update the holiday calendars. The same goes for market conventions, which rarely change, but should be loaded dynamically from a file or web location. It should be possible to add the defaults for a new currency without requiring a new library release. Being able to change configuration parameters, such as default algorithms, or tolerances, can be useful when debugging a problem on a trader&#8217;s desk.</p>
<p>The exception is the version number, which should be compiled into the library. Otherwise there is a chance that any configuration files may get separated, or fail to be overwritten, and inconsistencies introduced. This is also an argument for deploying a single dll, rather than many.</p>
<p><strong>Testing</strong></p>
<p>Testing should happen constantly. We focus on two main types of testing, regression tests and unit tests. Regression tests exercise the interface to the outside world, and ensure that results do not change between library versions. Unit tests are low level and test the functionality of a single class or function. C++ testing frameworks are available from <a href="http://www.boost.org/libs/test/doc/index.html">Boost</a> or <a href="http://cppunit.sourceforge.net/cppunit-wiki">CppUnit</a>.</p>
<p>There are now tools for many languages that generate test cases, and report which areas of the code are not covered by any tests. However, the tools available for C++ are much inferior to those for .NET or Java.</p>
<p>A quantitative library will probably also need to have a regression test suite to run Excel spreadsheets. In principle Excel regression tests should also be automated.</p>
<p><strong>Release</strong></p>
<p>No developer wants to spend time building a release manually, even so, much time is wasted releasing code. This implies that the release process should be completely automated, so it takes no time away from developers.</p>
<p>Release as a single zip, labeled with the date and release version. If releasing an XLL then it should be possible to start on any machine by double-clicking. It should not be necessary to change the registry settings for the machine, add environment variables, or modify the path. All these factors take developer time and increase the chance of mistakes.</p>
<p><strong>Client Systems</strong></p>
<p>If any systems have a dependency on the analytics library they should be tied to a release schedule. This prevents large gaps of six months or a year between integrations. In this time many things change and the amount of work needed to integrate increases greatly. The main overnight system is always under development, so should integrate analytics releases once a month. Other applications that depend on stable core analytics may only need to integrate every three months.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/implementing-a-build-and-release-process/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Assert Macros in C++</title>
		<link>http://www.quantlib.co.uk/blog/assert-macros-in-c</link>
		<comments>http://www.quantlib.co.uk/blog/assert-macros-in-c#comments</comments>
		<pubDate>Wed, 05 Dec 2007 13:12:56 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>
<category>C</category>
		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/assert-macros-in-c</guid>
		<description><![CDATA[Using assertions is essential in defensive C++ programming. However, you want to see the filename and line number in the error, right. This leads back to using a macro, and we all know how nasty they are   All is explained in this excellent article: http://powerof2games.com/node/10

]]></description>
			<content:encoded><![CDATA[<p>Using assertions is essential in defensive C++ programming. However, you want to see the filename and line number in the error, right. This leads back to using a macro, and we all know how nasty they are <img src='http://www.quantlib.co.uk/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  All is explained in this excellent article: <a href="http://powerof2games.com/node/10">http://powerof2games.com/node/10</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/assert-macros-in-c/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Disabling the Function Wizard in Excel</title>
		<link>http://www.quantlib.co.uk/blog/disabling-the-function-wizard-in-excel</link>
		<comments>http://www.quantlib.co.uk/blog/disabling-the-function-wizard-in-excel#comments</comments>
		<pubDate>Wed, 07 Nov 2007 16:22:47 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/disabling-the-function-wizard-in-excel</guid>
		<description><![CDATA[Some functions in quantitative libraries take a long time to evaluate. If you then export this function to Excel and try to populate the arguments via the function wizard you will find that the wizard is totally unresponsive. This is because the function is reevaluated every time you enter an argument. You have to disable recalculation [...]]]></description>
			<content:encoded><![CDATA[<p>Some functions in quantitative libraries take a long time to evaluate. If you then export this function to Excel and try to populate the arguments via the function wizard you will find that the wizard is totally unresponsive. This is because the function is reevaluated every time you enter an argument. You have to disable recalculation in the Excel function wizard, otherwise it is unuseable. To do this read <a href="http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/SFEF9.asp">this</a>, which is implemented in <a href="http://xlw.sourceforge.net/">xlw</a>.</p>
<p>I had some linker errors, LNK2001, in Visual C++ 6.0 such as __imp__GetParent, __imp__GetClassName, and __imp__EnumWindows. This was resolved by including user32.lib in the libraries to link against.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/disabling-the-function-wizard-in-excel/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Computing the Nearest Correlation Matrix a Problem From Finance</title>
		<link>http://www.quantlib.co.uk/blog/computing-the-nearest-correlation-matrix-a-problem-from-finance</link>
		<comments>http://www.quantlib.co.uk/blog/computing-the-nearest-correlation-matrix-a-problem-from-finance#comments</comments>
		<pubDate>Thu, 22 Mar 2007 23:26:55 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<category>Maths</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/?p=10</guid>
		<description><![CDATA[This algorithm by Nicholas Higham finds the nearest correlation matrix given an example matrix. It does this by alternate projections onto unit diagonal and positive semidefinite matrices. The paper can be found via: http://citeseer.ist.psu.edu/higham02computing.html
Here are some matlab snippets for computing the nearest correlation matrix:
function [U] = projU(U)
x = size(U);
n = x(1,1);
for i=1:n
U(i,i) = 1;
end
function [M] [...]]]></description>
			<content:encoded><![CDATA[<p>This algorithm by <span class="m">Nicholas Higham finds the nearest correlation matrix given an example matrix. It does this by alternate projections onto unit diagonal and positive semidefinite matrices. The paper can be found via:</span> <a title="here" href="http://citeseer.ist.psu.edu/higham02computing.html">http://citeseer.ist.psu.edu/higham02computing.html</a><a id="more-10"></a></p>
<p>Here are some matlab snippets for computing the nearest correlation matrix:</p>
<p>function [U] = projU(U)<br />
x = size(U);<br />
n = x(1,1);<br />
for i=1:n<br />
U(i,i) = 1;<br />
end</p>
<p>function [M] = projS(A)<br />
[V,D] = eig(A);<br />
x = size(D);<br />
n = x(1,1);<br />
for i=1:n<br />
D(i,i) = max(D(i,i), 0);<br />
end<br />
M = V*D*V&#8217;;</p>
<p>function [Y] = nearCorr(A)<br />
temp = size(A);<br />
n = temp(1,1);<br />
deltaS = zeros(n);<br />
Y = A;<br />
X = A;<br />
R = A;<br />
for i=1:40<br />
R = Y - deltaS;<br />
X = projS(R);<br />
deltaS = X - R;<br />
Y = projU(X);<br />
end
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/computing-the-nearest-correlation-matrix-a-problem-from-finance/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Visual Studio 2005 Service Pack 1</title>
		<link>http://www.quantlib.co.uk/blog/visual-studio-2005-service-pack-1</link>
		<comments>http://www.quantlib.co.uk/blog/visual-studio-2005-service-pack-1#comments</comments>
		<pubDate>Thu, 22 Mar 2007 23:19:34 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/?p=9</guid>
		<description><![CDATA[Don&#8217;t install it&#8230; It has totally screwed up my installation of Visual Studio 2005 Express Edition. If you don&#8217;t have over about 4Gb free on the drive it rolls back and deletes your C runtime dll libraries.

]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t install it&#8230; It has totally screwed up my installation of Visual Studio 2005 Express Edition. If you don&#8217;t have over about 4Gb free on the drive it rolls back and deletes your C runtime dll libraries.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/visual-studio-2005-service-pack-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jfig</title>
		<link>http://www.quantlib.co.uk/blog/jfig</link>
		<comments>http://www.quantlib.co.uk/blog/jfig#comments</comments>
		<pubDate>Wed, 17 Jan 2007 16:03:50 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/?p=8</guid>
		<description><![CDATA[I have found a useful implementation of the fig drawing program in Java that is very useful if you want to do simple diagrams for LaTeX documents, but are working in a Windows environment where xfig is not readily available. Just use the Java webstart at here.
fig2dev -L pstex fig42.fig fig42.ps
fig2dev -L pstex_t -p fig42.ps [...]]]></description>
			<content:encoded><![CDATA[<p>I have found a useful implementation of the fig drawing program in Java that is very useful if you want to do simple diagrams for LaTeX documents, but are working in a Windows environment where xfig is not readily available. Just use the Java webstart at <a href="http://tams-www.informatik.uni-hamburg.de/applets/jfig/webstart.html">here</a>.</p>
<p align="left">fig2dev -L pstex fig42.fig fig42.ps</p>
<p align="left">fig2dev -L pstex_t -p fig42.ps fig42.fig fig42.tex</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/jfig/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C++ header file include patterns</title>
		<link>http://www.quantlib.co.uk/blog/c-header-file-include-patterns</link>
		<comments>http://www.quantlib.co.uk/blog/c-header-file-include-patterns#comments</comments>
		<pubDate>Wed, 17 Jan 2007 14:26:02 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/?p=7</guid>
		<description><![CDATA[Some our our build processes are taking longer than they should. Much of this is probably due to including too many references to different files, and not using forward class declarations wherever possible. This is well explained in C++ header file include patterns. If your library design does not take this into account your build [...]]]></description>
			<content:encoded><![CDATA[<p>Some our our build processes are taking longer than they should. Much of this is probably due to including too many references to different files, and not using forward class declarations wherever possible. This is well explained in <a title="C++ header file include patterns" href="http://www.eventhelix.com/RealtimeMantra/HeaderFileIncludePatterns.htm">C++ header file include patterns</a>. If your library design does not take this into account your build process will get slower and slower.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/c-header-file-include-patterns/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C++ code obfuscator</title>
		<link>http://www.quantlib.co.uk/blog/c-code-obfuscator</link>
		<comments>http://www.quantlib.co.uk/blog/c-code-obfuscator#comments</comments>
		<pubDate>Mon, 15 Jan 2007 18:44:25 +0000</pubDate>
		<dc:creator>neil</dc:creator>
		
		<category>Software</category>

		<guid isPermaLink="false">http://www.quantlib.co.uk/blog/?p=6</guid>
		<description><![CDATA[I happened to be looking for a code obfuscator for C++ and came across COBF. It is easy enough to get it working on a single file. However, when you have a large library which exports many symbols from the dll it is difficult to make a script file that can easily take an existing [...]]]></description>
			<content:encoded><![CDATA[<p>I happened to be looking for a code obfuscator for C++ and came across <a title="COBF" href="http://home.arcor.de/bernhard.baier/cobf/index.htm">COBF</a>. It is easy enough to get it working on a single file. However, when you have a large library which exports many symbols from the dll it is difficult to make a script file that can easily take an existing VC++ solution and obfuscate the entire project.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quantlib.co.uk/blog/c-code-obfuscator/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
