<?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>Brainfold &#187; numpy</title>
	<atom:link href="http://www.brainfold.org/blog/tag/numpy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brainfold.org/blog</link>
	<description>On Python, game development and everything</description>
	<lastBuildDate>Sat, 15 May 2010 21:58:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PyEigen 0.2 feature complete</title>
		<link>http://www.brainfold.org/blog/2010/05/03/pyeigen-0-2-feature-complete/</link>
		<comments>http://www.brainfold.org/blog/2010/05/03/pyeigen-0-2-feature-complete/#comments</comments>
		<pubDate>Mon, 03 May 2010 07:43:57 +0000</pubDate>
		<dc:creator>Jussi Lepistö</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[numpy]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[pyeigen]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.brainfold.org/blog/?p=292</guid>
		<description><![CDATA[After a couple of weeks of hiatus, the 0.2 release of PyEigen is now feature complete. What's left is some testing and documentation, then release. I postponed quaternions and transformations to 0.3 because variable-size matrices were plenty of work for a single release and single programmer already; I don't want too much time between releases [...]]]></description>
			<content:encoded><![CDATA[<p>After a couple of weeks of hiatus, the 0.2 release of PyEigen is now feature complete. What's left is some testing and documentation, then release. I postponed quaternions and transformations to 0.3 because variable-size matrices were plenty of work for a single release and single programmer already; I don't want too much time between releases at such an early stage. If I'm not too busy, PyEigen 0.2 should be released in a week or two.</p>
<p>I did some benchmarking on 1000x1000 matrices. Insanely, enabling SSE2 instructions speeded up that test case by 10x; I was expecting a 4x increase at most, since SSE instructions handle 4 times the data per instruction. NumPy is slightly faster for 1000x1000 matrix multiplication, but there's an obvious optimization in PyEigen that will hopefully make it faster again. That will have to wait for 0.3 though, since it's a bit tedious to implement. For those interested: there's an extra matrix copy in all PyEigen functions and operators that return a value, which I can probably optimize away.</p>
<p>BTW, if you want more frequent progress updates, you can follow my <a href="http://twitter.com/Knarkles">Twitter feed</a>. <img src='http://www.brainfold.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.brainfold.org/blog/2010/05/03/pyeigen-0-2-feature-complete/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PyEigen</title>
		<link>http://www.brainfold.org/blog/2010/03/16/pyeigen/</link>
		<comments>http://www.brainfold.org/blog/2010/03/16/pyeigen/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 08:06:29 +0000</pubDate>
		<dc:creator>Jussi Lepistö</dc:creator>
				<category><![CDATA[boost.python]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[cython]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[linear algebra]]></category>
		<category><![CDATA[numpy]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[pyeigen]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[swig]]></category>

		<guid isPermaLink="false">http://www.brainfold.org/blog/?p=203</guid>
		<description><![CDATA[I have a new project called PyEigen, a wrapper for the C++ linear algebra library Eigen. I just submitted the first batch of code and progress is good, at least so far. I'm hoping for an initial release within a month or so. The whole thing started when I profiled my shooter project and found [...]]]></description>
			<content:encoded><![CDATA[<p>I have a new project called <a href="http://launchpad.net/pyeigen">PyEigen</a>, a wrapper for the C++ linear algebra library <a href="http://eigen.tuxfamily.org/">Eigen</a>. I just submitted the first batch of code and progress is good, at least so far. <img src='http://www.brainfold.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I'm hoping for an initial release within a month or so.</p>
<p>The whole thing started when I profiled my shooter project and found that matrix calculations take up a huge amount of time. Apparently <a href="http://numpy.scipy.org/">NumPy</a> isn't really fast enough for 3D games, and I couldn't find any replacements. While otherwise looking good, <a href="http://www.partiallydisassembled.net/euclid.html">euclid</a> and <a href="http://code.google.com/p/vectypes/">vectypes</a> are pure Python so they aren't going to make performance any better. <a href="http://cgkit.sourceforge.net/">cgkit </a>is C++ with a Python wrapper so looking better already, but... it's using <a href="http://www.boost.org/doc/libs/1_42_0/libs/python/doc/index.html">Boost.Python</a>, which <a href="http://chrischou.wordpress.com/2010/02/28/simple-benchmark-between-cython-and-boost-python/">apparently isn't very fast</a>. Also, it's lacking SSE instrumentation and other optimizations included in Eigen. So I decided to wrap Eigen.</p>
<p>As I already found out, Boost.Python is slow and looked too complex for such a simple library anyway. I tried <a href="http://cython.org/">Cython</a> next, but its C++ support is (still) very limited and the lack of support for C++ references destroyed any hope of wrapping Eigen, which relies heavily on them. My final option before resorting to manual wrapping using the Python C API was <a href="http://swig.org/">SWIG</a>, but I had problems getting even a simple wrapper to compile. Besides, I don't really like how SWIG generates function wrappers and a separate Python module that calls those wrappers instead of generating a Python C module directly.</p>
<p>So I was left with only the final option: Python C API. I feared it at first because I've never worked with it and it seemed really complex. It <em>is</em> complex, but not nearly as bad as I though, especially as Eigen has such a simple API. For <a href="http://bulletphysics.org/">Bullet</a>, I'm sure I'll use Cython or some other wrapper generator, but for Eigen the Python C API is just fine.</p>
<p>Anyway, since there doesn't seem to be anything like this out there, I decided to make it an open source project so hopefully other people in the same situation won't have to jump through the same hoops as I did. I'll post progress reports, releases and especially benchmarks against the other options as soon as I have them.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">http://launchpad.net/pyeigenI h</div>
]]></content:encoded>
			<wfw:commentRss>http://www.brainfold.org/blog/2010/03/16/pyeigen/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
