<?xml version="1.0" encoding="utf-8"?>
<!-- If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/ -->
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:lj="http://www.livejournal.com">
  <id>urn:lj:livejournal.com:atom1:bjacob</id>
  <title>Benoît Jacob</title>
  <subtitle>Benoît Jacob</subtitle>
  <author>
    <name>Benoît Jacob</name>
  </author>
  <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/"/>
  <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom"/>
  <updated>2008-07-01T16:22:43Z</updated>
  <lj:journal username="bjacob" type="personal"/>
  <link rel="service.feed" type="application/x.atom+xml" href="http://bjacob.livejournal.com/data/atom" title="Benoît Jacob"/>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:6600</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/6600.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=6600"/>
    <title>Eigen2 as a vectorization library</title>
    <published>2008-07-01T16:17:38Z</published>
    <updated>2008-07-01T16:22:43Z</updated>
    <category term="eigen vectorization mandelbrot fractal"/>
    <content type="html">A big issue for any math-oriented software is vectorization i.e. how to make use of instruction sets such as SSE or AltiVec. Unfortunately this seems to be very hard for the compiler to do automatically, and even with Intel's own compiler, with complicated C++ code such as ours, the benefits were small (like +25% with ICC and +5% with GCC).&lt;br /&gt;&lt;br /&gt;Yet, the theoretical benefit of vectorization is huge: with SSE, computations of floats can become 4x faster, and more in certain cases. So what math libraries tend to do, is to write their own explicitly vectorized paths for each architecture (SSE, AltiVec...) they support.&lt;br /&gt;&lt;br /&gt;This is what &lt;a href="http://g.gael.free.fr/"&gt;Gael Guennebaud&lt;/a&gt; did a few monthes ago in &lt;a href="http://websvn.kde.org/branches/work/eigen2"&gt;Eigen2&lt;/a&gt;. We now have &lt;a href="http://websvn.kde.org/branches/work/eigen2/Eigen/src/Core/DummyPacketMath.h?view=markup"&gt;generic wrappers&lt;/a&gt; for vectorized operations: they abstract the underlying architecture and packet format, and are template in the numeric type. They got specialized by Gael for &lt;a href="http://websvn.kde.org/branches/work/eigen2/Eigen/src/Core/arch/SSE/PacketMath.h?view=markup"&gt;SSE2 and SSE3&lt;/a&gt; and by &lt;a href="http://www.freevec.org"&gt;Konstantinos Margaritis&lt;/a&gt; for &lt;a href="http://websvn.kde.org/branches/work/eigen2/Eigen/src/Core/arch/AltiVec/PacketMath.h?view=markup"&gt;AltiVec&lt;/a&gt;. Gael went on and made many parts of Eigen2 use these when applicable, so the end result is that Eigen can draw a large benefit form vectorization instructions when they are available (SSE or AltiVec), in a way that's completely transparent to the user, with graceful fallback to non-vectorized paths.&lt;br /&gt;&lt;br /&gt;So we are now getting nice speedups like 4.7x for dot products of large vectors of floats, and 4x for the sum of coefficients of a vector. Gael also wrote a &lt;a href="http://eigen.tuxfamily.org/wiki/index.php?title=EigenInternals"&gt;super optimized&lt;/a&gt; &lt;a href="http://websvn.kde.org/branches/work/eigen2/Eigen/src/Core/CacheFriendlyProduct.h?view=markup"&gt;cache-friendly matrix product&lt;/a&gt; also taking full advantage of vectorization (3.5x for large matrices).&lt;br /&gt;&lt;br /&gt;But what if Eigen2's vectorization could be used for more than just vector/matrix computations? Its expression templates allow it to be used even for very small computations without any overhead, which makes it an ideal candidate for being used as a generic vectorization framework. Calling 'Real' the type of the numbers we're dealing with, one can proceed as follows:&lt;br /&gt;&lt;pre&gt;
&lt;span style="color: #141312"&gt;  enum { packetSize = Eigen::ei_packet_traits&amp;lt;Real&amp;gt;::size }; // number of reals in a Packet&lt;/span&gt;
&lt;span style="color: #141312"&gt;  typedef Eigen::Matrix&amp;lt;Real, packetSize, 1&amp;gt; Packet; // wrap a Packet as a vector&lt;/span&gt;
&lt;/pre&gt;&lt;br /&gt;And one can then use this Packet type to abstract the packets of the vectorization architecture. If there is no vectorization, a Packet will contain just one number.&lt;br /&gt;&lt;br /&gt;So what I did was to start from here and do &lt;a href="http://websvn.kde.org/branches/work/eigen2/demos/mandelbrot/"&gt;a little demo&lt;/a&gt;: a &lt;a href="http://en.wikipedia.org/wiki/Mandelbrot_set"&gt;Mandelbrot Set&lt;/a&gt; viewer. It is up to 2.3x faster thanks to vectorization. It switches automatically between single and double precision. Normally that would have required one to write the vectorized paths twice for each architecture, but not so thanks to Eigen2, all that is abstracted.&lt;br /&gt;&lt;br /&gt;If you're interested in checking it out:&lt;br /&gt;&lt;pre&gt;
svn co svn://anonsvn.kde.org/home/kde/branches/work/eigen2
mkdir eigen2-build
cd eigen2-build
cmake -DTEST_SSE2=ON -DBUILD_DEMOS=ON ../eigen2
make
demos/mandelbrot/mandelbrot
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Some notes... it uses Qt's great threading framework to use as many threads as necessary to take advantage of your multi-core CPU; nevertheless the code is so small -- about 200 lines of code all in all, of which about 50 lines for the actual rendering -- that I am thinking that it could be a nice little plasma background-painter (or whatever plasma gurus call that!) for the KDE 4.2 timeframe! I for one would like my fractal wallpaper to come to life. Something's badly needed though: to make the rendering not block the user interaction. If you wish to help with that you're welcome! Another note: if you're serious about fractals be sure to check out &lt;a href="http://fraqtive.mimec.org/"&gt;Fraqtive&lt;/a&gt;! Of course the little toy program I'm presenting here is no match for Fraqtive.&lt;br /&gt;&lt;br /&gt;Mandatory screenshot:&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/mandelbrot.png"&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:6283</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/6283.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=6283"/>
    <title>benchmarking virtual function calls in c++</title>
    <published>2008-06-20T17:14:47Z</published>
    <updated>2008-06-20T20:12:35Z</updated>
    <category term="c++ virtual"/>
    <content type="html">This is a followup to my two previous blog entries...&lt;br /&gt;&lt;br /&gt;In order to measure the speed overhead of virtual function calls, I wrote a simple 3-float vector class with a dot-product method. One version is done without virtual functions, all in a single Vector class. The other version uses a pure virtual base class VectorBase implementing the dot product, and the vector coordinates accessors are virtual. Aside from that, there is no difference in the code.&lt;br /&gt;&lt;br /&gt;The benchmark is &lt;a href="http://math.jussieu.fr/~jacob/virtual/"&gt;here&lt;/a&gt;, and archive is &lt;a href="http://math.jussieu.fr/~jacob/virtual.tar.gz"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The &lt;a href="http://math.jussieu.fr/~jacob/virtual/README"&gt;results&lt;/a&gt; are impressive: the virtual version runs &lt;b&gt;3x slower&lt;/b&gt; than the no-virtual version.&lt;br /&gt;&lt;br /&gt;Cool, now I'll have firm numbers to back up my design choices in Eigen :)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bjacob.livejournal.com/5800.html?thread=73896#t73896"&gt;Simon&lt;/a&gt;, I hope that answers your request :)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update:&lt;/b&gt;Gael found out that the big speed difference is in fact explained by the fact that the non-virtual function gets inlined. That also explains why more people get the same result with -O3 than with -O2. So that benchmark is not really measuring virtual function calls, instead it's more measuring the fact that virtual functions are less often inlined (and inlinable at all) than non-virtual functions, which is also a good reason not to use them in certain cases, like in the Eigen library for example where inlining of trivial functions is crucial.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:6110</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/6110.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=6110"/>
    <title>virtual c++ classes and performance</title>
    <published>2008-06-20T08:44:11Z</published>
    <updated>2008-06-21T10:13:49Z</updated>
    <category term="c++ virtual"/>
    <content type="html">My &lt;a href="http://bjacob.livejournal.com/5800.html"&gt;previous blog entry&lt;/a&gt; started a debate on the overhead of virtual classes in c++.&lt;br /&gt;&lt;br /&gt;First of all let's recall some facts, which I already recalled in my previous blog entry:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In most cases, the overhead of virtual classes in c++ is negligible. In most cases, there is no reason not to use virtual.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;There. So if you're coding a GUI application or even many kinds of libraries, there is nothing to see here, move along and keep using the wonderful c++ feature that is virtual classes.&lt;br /&gt;&lt;br /&gt;Now let's state the reasons why one might want in certain special cases to avoid 'virtual'.&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;1.&lt;/b&gt; It increases the "sizeof" of your class by the "sizeof" of a pointer, which is 4 or 8 bytes depending on your arch. In most cases you don't care. But if your classes have a small "sizeof" and you are going to create whole arrays of objects of it, then it suddenly becomes a big deal. In Eigen, the Vector2f (vector of two floats) has sizeof==8. If it were implemented as a virtual class, its sizeof becomes 12 (on x86 architecture) or even 16 (on x86_64). This means that an application storing large arrays of such vectors could see its memory usage double.&lt;br /&gt;&lt;br /&gt;Note: I am not a c++ expert, so I checked before posting, and the sizeof of virtual classes indeed did increase by the sizeof of a pointer.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;2.&lt;/b&gt; "Virtual inline" makes no sense, so if the compiler decides to inline a virtual function, it has to strip away its virtualness. There are circumstances under which it just can't allow itself to do that. If you rely heavily on inlining of trivial functions (like Eigen does) and are coding a library or template library (which is the case where inlining a virtual function might be problematic) then just be aware that sometimes the compiler won't inline your virtual functions.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;3. (Updated several times -- will blog again to clarify)&lt;/b&gt; Even leaving aside inlining considerations, a virtual function call is slower because it requires first a lookup in the class's vtable; Here is a  &lt;a href="http://math.jussieu.fr/~jacob/virtual/"&gt;benchmark&lt;/a&gt; for that, &lt;a href="http://math.jussieu.fr/~jacob/virtual.tar.gz"&gt;here&lt;/a&gt; is an archive; I first believedthat it was showing the virtual version running &lt;b&gt;more than 3x slower&lt;/b&gt; than the non-virtual version, but it turns out to just be that the non-virtual version gets inlined (which supports point 2 above). It seems hard and perhaps pointless to measure the raw cost of virtual calls.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;4.&lt;/b&gt; Virtual function calls are indirect calls to locations computed at runtime. This may or may not cause trouble to the CPU's branch prediction mechanism. What I heard is that it used to, but modern CPUs don't have much trouble anymore with that. Anyway, this is very hard to quantify in a simple benchmark; if the issue exists at all on modern CPUs then it will probably show up only in involved examples.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion :&lt;/b&gt; There is absolutely no problem about "virtual" for non-computation-intensive code, like e.g. GUI code. In computation-intensive code, like e.g. in the back-end of an OpenGL application, things may be different.&lt;br /&gt;&lt;br /&gt;That's all :)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:5800</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/5800.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=5800"/>
    <title>C++ techniques: part 1: curiously recurring template pattern</title>
    <published>2008-06-18T22:54:01Z</published>
    <updated>2008-06-20T05:13:56Z</updated>
    <category term="c++ curious crt crtp"/>
    <content type="html">I've been thinking for a while that I should be blogging about some c++ metaprogramming techniques that I learned while coding &lt;a href="http://eigen.tuxfamily.org/wiki"&gt;Eigen&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;li&gt; 1. the curiously recurring template pattern&lt;/li&gt;&lt;br /&gt;&lt;li&gt; 2. "meta" versions of "if", "==", and other things&lt;/li&gt;&lt;br /&gt;&lt;li&gt; 3. expression templates &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;Of course these techniques have been "known" for a long time, since they were discovered in the 90's. Some of them are already used in KDE; I saw some use of 1. in KHTML/KJS (&lt;b&gt;edit:&lt;/b&gt; although not used for the same thing as discussed in this post), and 2 is quite commonplace anyway. Perhaps 3 is the least-known one, and the only one in which I'd have anything original to say.&lt;br /&gt;&lt;br /&gt;Today let's talk about the &lt;b&gt;curiously recurring template pattern&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Executive summary: this technique allows you, in certain cases, to get rid of "virtual" keywords, thus avoiding the overhead of a vtable and indirect function calls (&lt;b&gt;edit:&lt;/b&gt; note that this is only one use of this technique, there are other uses which I don't discuss).&lt;br /&gt;&lt;br /&gt;&lt;a name="cutid1"&gt;&lt;/a&gt;Let's look at the classical example below, which shows an abstract base class with a method to returning some data determined by the derived class -- something typically implemented using the "virtual" keyword.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 110, 40);"&gt;#include &amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;&lt;b&gt;class&lt;/b&gt; Animal&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;protected&lt;/b&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; age_in_years;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;public&lt;/b&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    Animal(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; i) : age_in_years(i) {}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    &lt;b&gt;virtual&lt;/b&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; actual_age() &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;const&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; = &lt;/span&gt;&lt;span style="color: rgb(176, 128, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;&lt;b&gt;class&lt;/b&gt; Dog : &lt;b&gt;public&lt;/b&gt; Animal&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;public&lt;/b&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    Dog(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; i) : Animal(i) {}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    &lt;b&gt;virtual&lt;/b&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; actual_age() &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;const&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;      &lt;/span&gt;&lt;span style="color: rgb(136, 135, 134);"&gt;&lt;i&gt;// one year is 7 dog-years&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;      &lt;b&gt;return&lt;/b&gt; &lt;/span&gt;&lt;span style="color: rgb(176, 128, 0);"&gt;7&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; * age_in_years;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; msg(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;const&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; Animal&amp;amp; a)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  std::cout &amp;lt;&amp;lt; &lt;/span&gt;&lt;span style="color: rgb(191, 3, 3);"&gt;"This animal feels "&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; &amp;lt;&amp;lt; a.actual_age()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;            &amp;lt;&amp;lt; &lt;/span&gt;&lt;span style="color: rgb(191, 3, 3);"&gt;" years old."&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; &amp;lt;&amp;lt; std::endl;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; main(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;char&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;*[])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  Dog d(&lt;/span&gt;&lt;span style="color: rgb(176, 128, 0);"&gt;3&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  msg(d);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;return&lt;/b&gt; &lt;/span&gt;&lt;span style="color: rgb(176, 128, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The crucial point in the above program is that the msg() function takes an Animal, and the Animal class itself does not know how to compute actual_age(), so the virtual keyword tells the compiler to add complicated machinery (known as a &lt;a href="http://en.wikipedia.org/wiki/Virtual_table"&gt;vtable&lt;/a&gt;) to class Animal allowing to resolve the actual_age() call depending on the derived class. That machinery has a cost. Most C++ features, including OOP concepts, come at zero cost: that is the beauty of C++, something Stroustrup refers to as the "zero-overhead principle". This particular feature however (virtual functions), has a cost, so you don't want to pay it unless it's negligible. In many settings (like coding a GUI with Qt) this cost is negligible, but in other cases (like the above example) it is not.&lt;br /&gt;&lt;br /&gt;Can you avoid paying that cost? The "virtual" keyword is in fact a very powerful tool, as the call to actual_age() is resolved at run-time. Sometimes you just need that: then there is no way to avoid using "virtual", and that cost is justified. Some other times however, you don't need that as the call to actual_age() can be resolved at compile-time.&lt;br /&gt;&lt;br /&gt;Here enters the &lt;b&gt;curiously recurring template pattern&lt;/b&gt;: it consists in using C++ templates to resolve the actual_age() call at compile-time. Here's how our program can be rewritten using that technique:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 110, 40);"&gt;#include &amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;&lt;b&gt;template&lt;/b&gt;&amp;lt;&lt;b&gt;typename&lt;/b&gt; Derived&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;&lt;b&gt;class&lt;/b&gt; Animal&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;protected&lt;/b&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; age_in_years;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;public&lt;/b&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    Animal(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; i) : age_in_years(i) {}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; actual_age() &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;const&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;      &lt;b&gt;return&lt;/b&gt; &lt;b&gt;static_cast&lt;/b&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;const&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; Derived*&amp;gt;(&lt;b&gt;this&lt;/b&gt;)-&amp;gt;_actual_age();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;&lt;b&gt;class&lt;/b&gt; Dog : &lt;b&gt;public&lt;/b&gt; Animal&amp;lt;Dog&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    &lt;b&gt;friend&lt;/b&gt; &lt;b&gt;class&lt;/b&gt; Animal&amp;lt;Dog&amp;gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; _actual_age() &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;const&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;      &lt;/span&gt;&lt;span style="color: rgb(136, 135, 134);"&gt;&lt;i&gt;// one year is 7 dog-years&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;      &lt;b&gt;return&lt;/b&gt; &lt;/span&gt;&lt;span style="color: rgb(176, 128, 0);"&gt;7&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; * age_in_years;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;public&lt;/b&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;    Dog(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; i) : Animal&amp;lt;Dog&amp;gt;(i) {}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;&lt;b&gt;template&lt;/b&gt;&amp;lt;&lt;b&gt;typename&lt;/b&gt; Derived&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; msg(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;const&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; Animal&amp;lt;Derived&amp;gt;&amp;amp; a)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  std::cout &amp;lt;&amp;lt; &lt;/span&gt;&lt;span style="color: rgb(191, 3, 3);"&gt;"This animal feels "&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; &amp;lt;&amp;lt; a.actual_age()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;            &amp;lt;&amp;lt; &lt;/span&gt;&lt;span style="color: rgb(191, 3, 3);"&gt;" years old."&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; &amp;lt;&amp;lt; std::endl;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt; main(&lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 87, 174);"&gt;char&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;*[])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  Dog d(&lt;/span&gt;&lt;span style="color: rgb(176, 128, 0);"&gt;3&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  msg(d);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;  &lt;b&gt;return&lt;/b&gt; &lt;/span&gt;&lt;span style="color: rgb(176, 128, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(20, 19, 18);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So the fun thing is that we have a circular "inheritance" (&lt;b&gt;edit:&lt;/b&gt; note the quotation marks) diagram,&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Dog ---&amp;gt; Animal&lt;dog&gt;&amp;lt;Dog&amp;gt; ---&amp;gt; Dog&lt;br /&gt;&lt;/dog&gt;&lt;/pre&gt;&lt;br /&gt;and this is in fact perfectly legal c++, has been handled correctly by c++ compilers for a long time, and as I said, is already being used in KHTML/KJS, in Eigen, and probably in many places I never looked at.&lt;br /&gt;&lt;br /&gt;Of course I'm not saying that virtual keywords should be replaced by that technique whenever possible: there are other considerations to balance. For example, this technique, making the base class a template taking the derived class as template parameter, will lead to duplication of the code of any function in the base class for every derived class calling it. So it may or may not be worth it... depending on the particular case it may be a life-saver (like it is in Eigen) or a very bad idea.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update:&lt;/b&gt; as some nitpickers at reddit pointed out, there is a good Wikipedia page on this technique &lt;a href="http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern"&gt;here&lt;/a&gt;.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:5447</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/5447.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=5447"/>
    <title>c++ template libraries and debugging info size</title>
    <published>2008-06-09T16:29:11Z</published>
    <updated>2008-06-09T16:29:11Z</updated>
    <content type="html">Dear Lazyweb,&lt;br /&gt;&lt;br /&gt;Short version: do you know any way to limit the size of debugging info generated by g++ when compiling code that uses a c++ template library?&lt;br /&gt;&lt;br /&gt;Long version: currently, with simple example programs using Eigen2 (a c++ pure template lib) the code generated by g++ at -g2 debugging level is 10x-30x bigger than the code generated at -g1 level, which itself is up to 1.3x-2x bigger than the code generated at -g0 level (no debugging).&lt;br /&gt;&lt;br /&gt;The problem is that g++ -g2 emits line number and local variable info not only for the application, but also for the template library itself. Which is not really needed.&lt;br /&gt;&lt;br /&gt;What would be cool would be to have g++ suddenly downgrade to -g1 when compiling code from the template library. So ideally, something like a set of #pragmas for controlling debugging levels, would be cool. Unfortunately that doesn't seem to exist. The closest thing that I have found, is the -femit-struct-debug-detailed option, which allows per-file tuning and in some case halves the executable size. However that still leaves the line number info and part of local variables info.&lt;br /&gt;&lt;br /&gt;An overkill solution at least to the line-number-info problem would be to install preprocessed versions of our template lib's headers, removing as many linebreaks as possible. Of course that's not optimal, and that wouldn't remove the local variables info.&lt;br /&gt;&lt;br /&gt;Any idea?&lt;br /&gt;&lt;br /&gt;P.S. Eigen 2.0 is going to rock extremely hard now that Gael Guennebaud has been hugely contributing for monthes now, and Konstantinos Margaritis lent a helping hand. Some teasers -- explicit SSE2/SSE3/AltiVec vectorization ; compile-time intelligent determination of which temporaries to remove and of which loops to unroll ; the list goes on very very long. Gael is already heavily using Eigen 2 in his own 90,000 SLOC project, and I aim to make sure &lt;a href="http://avogadro.openmolecules.net"&gt;Avogadro&lt;/a&gt; can port to Eigen 2 in about one month. From KDE's point of view, this should be 4.2 stuff.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:5246</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/5246.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=5246"/>
    <title>Eigen Mascot!</title>
    <published>2008-04-09T08:16:26Z</published>
    <updated>2008-04-09T08:16:26Z</updated>
    <category term="eigen owl mascot david benjamin ronnie t"/>
    <content type="html">A while ago I &lt;a href="http://bjacob.livejournal.com/4609.html"&gt;asked&lt;/a&gt; for proposals for &lt;a href="http://eigen.tuxfamily.org/2/"&gt;Eigen&lt;/a&gt;'s mascot owl. We got excellent proposals from 5 artists and exchanged many e-mails on Eigen's mailing list. Finally I uploaded the &lt;a href="http://download.tuxfamily.org/eigen/owls/"&gt;best pics from each artist&lt;/a&gt; and we voted. The vote occurred on the mailing list in order to ensure that mostly people with a true interest in Eigen, and who &lt;a href="http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2008/03/threads.html"&gt;followed&lt;/a&gt; the &lt;a href="http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2008/04/threads.html"&gt;discussions&lt;/a&gt;, participate. Other than that it was open to anyone. 9 people voted.&lt;br /&gt;&lt;br /&gt;Note that the drawings below are 'only' sketches (!)&lt;br /&gt;&lt;br /&gt;drumroll...dzing! The winner, and personally my favorite, is the "Silly Professor" in the top-right of this pic (Copyright 2008 David Benjamin, licensed under CC-BY-SA):&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/owls/David_four_owls.jpg"&gt;&lt;br /&gt;We'll be sure make use of the 'todo' and 'bugs' owl sketches. The 'engineer' is also very nice for a documentation section on internals.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;very close&lt;/b&gt; second (only 1 voice behind out of 9) is this one (Copyright 2008 &lt;a href="http://ronnietucker.co.uk"&gt;Ronnie Tucker&lt;/a&gt;):&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/owls/Ronnie_professor_1.jpg"&gt;&lt;br /&gt;&lt;br /&gt;Again, you can see &lt;a href="http://download.tuxfamily.org/eigen/owls/"&gt;here&lt;/a&gt; the other candidates.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:5086</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/5086.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=5086"/>
    <title>The extinction of standardization dinosaurs on the software planet</title>
    <published>2008-04-02T06:45:43Z</published>
    <updated>2008-04-02T08:45:18Z</updated>
    <category term="standards ooxml iso"/>
    <content type="html">According to &lt;a href="http://www.reuters.com/article/technologyNews/idUSL0179716920080401?sp=true"&gt;this&lt;/a&gt;, the ISO are now calling a "standard" the Microsoft Office format (which is cynically called "Office Open XML"). I won't elaborate on the reasons why this thing is the opposite of what a standard should be, as this is clear to anybody not influenced by Microsoft.&lt;br /&gt;&lt;br /&gt;What is interesting is that TeX, LaTeX, OGG/Vorbis, OGG/Theora, Perl, Python, PHP, Ruby, OCaml, are &lt;b&gt;not&lt;/b&gt; standardized by any organization. Yet everybody knows that they are "self-standardized" by the free availability of extensive documentation and/or a by free-as-in-freedom unobfuscated reference implementation.&lt;br /&gt;&lt;br /&gt;This shows that standardization organizations are no longer relevant in the software field. What really matters is free full documentation, free full implementation source code, and of course the absence of any patent risk. In other words, coming back to the fundamentals of what a standards is, what matters is evidence that any independent third-party can create and distribute a fully-conforming implementation. When this is the case, nobody needs an organization to certify that it is a standard.&lt;br /&gt;&lt;br /&gt;That the ISO just proved itself open to the influence of special interests, is the consequence, not the cause, of its present irrelevance (again, in the software field). Since it is not needed anymore, nobody knows exactly what its mission is, what role it should play. Which allowed Microsoft to redefine that to its own advantage.&lt;br /&gt;&lt;br /&gt;I think that the best move the ISO could now make is to acknowledge the limits of its own domain of application, which is the traditional industry, and to acknowledge that the software area is no longer such a traditional industry. In other words, ISO (and other standards organizations) should leave the whole software area, where they are not needed anymore.&lt;br /&gt;&lt;br /&gt;Thinking further about this, here is perhaps the deep reason why in the end, software is beyond the field of application of standards organizations. This reason is that software is actually "just" mathematics. That was not obvious in the first decades of the computer industry, but it is becoming a concrete reality. Publishing the source code of a program is the equivalent of publishing the proof of a theorem. This is why the free software movement is changing the rules regarding standardization of software. In mathematics, once the proof of a theorem is published, there is no need for any authority to certify that the theorem is true. Everybody can independently look at the proof and realize that it is. And everybody can use the theorem without consulting its author. Likewise, once a free format specification is published with a free software implementation, there is no need for any authority (i.e. any standards organization) to certify that it can be used independently by any third-party (i.e. that it can be considered a standard). Thus, in the 21st century, a "standard" is just anything that has a full, free software implementation.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:4609</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/4609.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=4609"/>
    <title>Eigen mascot owl:  we need an artist!</title>
    <published>2008-03-29T20:42:14Z</published>
    <updated>2008-03-29T20:45:04Z</updated>
    <category term="eigen mascot"/>
    <content type="html">Today I'm looking for an artist who would be willing to draw &lt;a href="http://eigen.tuxfamily.org/2"&gt;Eigen&lt;/a&gt;'s mascot. Eigen is a small but very powerful math library (linear algebra, i.e. matrices/vectors), and now's a good time for us to get a mascot as we are well on our way to releasing Eigen 2.0 in a few monthes, and are exceedingly proud of it :) Note that Eigen is getting more and more used in KDE (KGLLib, KTankBattle are two recent new users) and that the release of Eigen 2.0 will only accelerate that trend. It's also getting more and more users outside of KDE, some of whom have started contributing actively which is great.&lt;br /&gt;&lt;br /&gt;The idea for our mascot would be an &lt;b&gt;owl&lt;/b&gt;, and more specifically one "with ears" (i.e. a "duc"). I would like it to marry two aspects: it should be cute/cuddly, and it should still evocate the wisdom that owls are emblematic of (or at least an endearing and desperate attempt to look wise, from a little owl). A good approximation to what I have in mind is Archimedes, Merlin's pet owl in the Disney movie:&lt;br /&gt;&lt;br&gt;&lt;img src="http://download.tuxfamily.org/eigen/sword015.jpg"&gt;&lt;br&gt;&lt;br /&gt;(see &lt;a href="http://enchantedchateau2.tripod.com/sword2.html"&gt;here&lt;/a&gt; for more). However, I would like it to be a bit more chubby/round and younger-looking. I would also like it to less serious. A good idea of the roundedness and of the attitude that I have in mind is found in the tux icons at &lt;a href="http://tux.crystalxp.net"&gt;TuxFactory&lt;/a&gt;, like this famous one:&lt;br /&gt;&lt;br&gt;&lt;img src="http://tux.crystalxp.net/png/batux-tux-g1-hd-9667.png"&gt;&lt;br&gt;&lt;br /&gt;However here I don't want the glassy aspect. I would like it with a lot of feathers and a fluffy aspect. Also note that in the above Tux icon, I like very much the silly eyes. I see very much our owl like that, and the attempt at wisdom could then be represented by a small wing raised like a teacher lecturing... or whatever idea you come up with.&lt;br /&gt;&lt;br /&gt;In any case, if you'd like to contribute the Eigen mascot, please send your proposals to: eigen (at) lists tuxfamily org. It would be much appreciated! After we hopefully get a few proposals, we'll see which one is the most popular. Do not hesitate to write to us with only a sketch, so you can ensure early that people like what you're doing.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:4559</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/4559.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=4559"/>
    <title>Tuxfamily</title>
    <published>2008-03-18T14:12:36Z</published>
    <updated>2008-03-18T14:20:02Z</updated>
    <category term="tuxfamily"/>
    <content type="html">This blog entry is plainly advertising for a little French nonprofit forge, &lt;a href="http://tuxfamily.org"&gt;TuxFamily&lt;/a&gt;. Well I hope it's OK to advertise them since they're working in their freetime and offer their services without charge. They do not even use ads to make money.&lt;br /&gt;&lt;br /&gt;If you've been looking for hosting for your Free Software project, look no further, for this is the best forge that I know:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;It itself is entirely &lt;a href="http://www.vhffs.org/wiki/index.php"&gt;Free Software&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The server is &lt;b&gt;damn fast&lt;/b&gt;. Check how &lt;a href="http://eigen.tuxfamily.org"&gt;Eigen's website&lt;/a&gt; loads fast.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It runs PHP4 and PHP5 so you can easily put a wiki online. They even have a &lt;a href="http://faq.tuxfamily.org/InstallMediawiki/Fr"&gt;tutorial&lt;/a&gt; (French wiki; apparently it's not yet translated). They also have other features like SQL server, download area for large files (up to a gigabyte or more)...&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Not only the web server is fast, but SVN is also the fastest I've seen: "svn up" and "svn ci" take only a fraction of a second. They also support CVS... and &lt;a href="http://en.wikipedia.org/wiki/Git_%28software%29"&gt;Git&lt;/a&gt; !&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Likewise, the mailing lists are the fastest and most reliable I've seen. I rely on tuxfamily for Eigen's mailing lists, and the mail is consistently delivered within a few seconds.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It does not use any ads. No ads on your project website, no ads on their website, no ads in the mailing lists...&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The crew is awesome and very low-latency... all my requests have been handled within hours at most, and often within minutes.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;That's what I've known for a long time and made me think of Tuxfamily as 'great'. But recently something made it move to my 'awesome' category. I'm a mathematician and my work consists partly in editing &lt;a href="http://en.wikipedia.org/wiki/LaTeX"&gt;LaTeX&lt;/a&gt; files with colleagues. I've been looking for a forge to host collaborative math projects, i.e. doing math research in the same way as Free Software is done, just replacing C++ by LaTeX. &lt;a href="http://sourceforge.net"&gt;SourceForge&lt;/a&gt; refused, but Tuxfamily accepted.&lt;br /&gt;&lt;br /&gt;Lastly, Tuxfamily is running a &lt;a href="http://donation.tuxfamily.org"&gt;donation campaign&lt;/a&gt;. It's their first one in 5 years of existence, and all the more justified since they don't use ads.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:4321</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/4321.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=4321"/>
    <title>Eigen 2.0-alpha2; help wanted!</title>
    <published>2008-01-07T11:05:21Z</published>
    <updated>2008-01-09T13:19:35Z</updated>
    <category term="eigen eigen2 4.1 step krita"/>
    <content type="html">Now that KDE 4.0.0 is tagged I guess it's OK to divert developers attention to KDE 4.1 stuff :)&lt;br /&gt;&lt;br /&gt;So I just released &lt;a href="http://eigen.tuxfamily.org/2"&gt;Eigen 2.0-alpha2&lt;/a&gt;. &lt;a href="http://download.tuxfamily.org/eigen/eigen-2.0-alpha2.tar.gz"&gt;Source tarball&lt;/a&gt;, &lt;a href="http://websvn.kde.org/branches/work/eigen2/"&gt;Browse SVN&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Besides a ton of improvements over alpha1, the main novelty is that there is now quite complete &lt;a href="http://eigen.tuxfamily.org/2/annotated.html"&gt;API documentation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;New features since alpha1 include: ICC compiler support thanks to Gael Guennebaud, full enforcement of constness, support for row-major matrix storage (column-major remains default), and tons of API improvements and new methods.&lt;br /&gt;&lt;br /&gt;Now's the time where you can really start using Eigen2 in your own project, if the current feature set is enough for you. I'm very happy with the architecture, and benchmarks show that it's very fast. According to &lt;a href="http://www.dwheeler.com/sloccount/"&gt;sloccount&lt;/a&gt; there are 2,234 lines of code. Which is very, very little for what it does.&lt;br /&gt;&lt;br /&gt;In fact, there are not so many &lt;a href="http://ubiety.uwaterloo.ca/~tveldhui/papers/Expression-Templates/exprtmpl.html"&gt;expression-templates&lt;/a&gt;-enabled libraries out there:&lt;br /&gt;- &lt;a href="http://www.oonumerics.org/blitz/"&gt;Blitz++&lt;/a&gt; is of course great but is not a linear algebra library, so Eigen2 does not compete with it. Blitz++ is a general array library, and focuses on dynamic size while I want fixed size to be treated on an equal footing.&lt;br /&gt;- &lt;a href="http://tvmet.sourceforge.net/"&gt;TVMET&lt;/a&gt; only does fixed-size, does not allow expressions to be lvalues, etc., while having 5x more lines of code than Eigen2 (granted, it has some functionality not yet present in eigen2 such as applying a function to each coefficient). That said I have a huge respect for TVMET as it is by reading its source code that I learnt expression templates.&lt;br /&gt;- &lt;a href="http://www.boost.org/libs/numeric/ublas/doc/index.htm"&gt;Boost::uBLAS&lt;/a&gt; does not fully take advantage of expression templates. It treats them as a mere optimization that can be enabled/disabled at compilation. While expression templates are a great optimization, I believe that the most interesting thing about them is what they allow in terms of API design. Operating on the rows of a matrix should be as simple as &lt;pre&gt;matrix.row(i) += factor * matrix.row(j);&lt;/pre&gt;This is what Eigen2 allows. This way one can write C++ code that really looks like pseudocode, and at the same time that's optimized. This is the real beauty of expression templates, and I regret that Boost::uBLAS doesn't take advantage of it. Another thing is that, like any BLAS, Boost::uBLAS only provides very basic functionality and one then needs to use another library for more functionality (such as inverting a matrix). By contrast, Eigen aims to be self-contained to cover all the usual needs of applications.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update:&lt;/b&gt;I just found &lt;a href="http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Frequently_Asked_Questions_Using_UBLAS"&gt;this&lt;/a&gt;: apparently fixed-size matrices and vectors are slow in uBLAS and for fixed-size they recommend to use TVMET instead! It's a small world.&lt;br /&gt;&lt;br /&gt;I hope to have convinced you that by contributing to Eigen, you would be contributing to a very exciting project! For this is the motivation of this post: &lt;b&gt;I need help&lt;/b&gt;!&lt;br /&gt;&lt;br /&gt;While the Core module is quite complete, there are at least 6 more modules that we want to have for Eigen 2.0. I don't have time to write them all! &lt;b&gt;So here is a &lt;a href="http://techbase.kde.org/index.php?title=Projects/Eigen/TODO"&gt;TODO&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;I would like very much to find volunteers quickly as the KDE 4.1 feature freeze is probably not too far away (though at least 3 monthes away) and if Eigen2 is good enough soon enough, it might be useful for several very exciting things in KDE 4.1, such as &lt;a href="http://edu.kde.org/step/"&gt;Step&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Then, a major user of Eigen2 will quite probably be &lt;a href="http://koffice.kde.org"&gt;KOffice&lt;/a&gt; 2.1, but this leaves us more time. Interestingly, the most advanced feature that &lt;a href="http://www.koffice.org/krita/"&gt;KOffice/Krita&lt;/a&gt; requires, namely sparse matrix support, is also what &lt;a href="http://edu.kde.org/step/"&gt;Step&lt;/a&gt; requires. So, to any potential volunteer: by doing that, you will be a hero to both &lt;a href="http://koffice.kde.org"&gt;KOffice&lt;/a&gt; and &lt;a href="http://edu.kde.org"&gt;KDE-Edu&lt;/a&gt;!</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:3934</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/3934.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=3934"/>
    <title>Eigen 2.0-alpha1</title>
    <published>2007-12-18T10:04:48Z</published>
    <updated>2007-12-18T10:04:48Z</updated>
    <category term="eigen"/>
    <content type="html">Just a quick notice: I've released a first alpha of Eigen2; very preliminary website &lt;a href="http://eigen.tuxfamily.org/2/"&gt;here&lt;/a&gt; (no documentation for now), source tarball &lt;a href="http://download.tuxfamily.org/eigen/eigen-2.0-alpha1.tar.gz"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It's very far from being feature-complete. Only the Core module is there, while several others are planned.&lt;br /&gt;&lt;br /&gt;That's all for now, I don't want to distract the KDE community too much from the upcoming 4.0 release :)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:3655</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/3655.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=3655"/>
    <title>kde4 perfectly usable</title>
    <published>2007-10-20T15:58:25Z</published>
    <updated>2007-10-20T15:58:25Z</updated>
    <category term="kde kde4"/>
    <content type="html">I am now running a full KDE4 session, from a svn checkout from yesterday. That's 10+ days after the tagging of beta3, and at the current pace of bugfixing, this means a lot of improvements.&lt;br /&gt;&lt;br /&gt;So what's it like? &lt;a href="http://download.tuxfamily.org/eigen/snapshot1.png"&gt;Here's the obligatory screenshot.&lt;/a&gt; You can see Okular annotating a .djvu file (of course it also works with .pdf files) and Marble, which is a bit like Google Earth except that it can be embedded in any KDE4 app, which opens endless possibilities. You can also see the Battery plasmoid, which reacts instantly when you plug/unplug your laptop, and the Pager plasmoid, which works just as in KDE3. KWin defaulted to using OpenGL for compositing, and it works great here. Slamming the mouse to the top-right corner triggers the very useful Present Windows effect.&lt;br /&gt;&lt;br /&gt;For me it's all perfectly usable, so I'm staying under KDE4 full-time. Not only to help with beta-testing (I already filed &lt;a href="http://bugs.kde.org/show_bug.cgi?id=151083"&gt;this bug report&lt;/a&gt;), but really because it already is stable and complete enough for me to use as my main desktop. I'm still using some KDE3 apps in my KDE4 session, but that's not a problem at all -- though of course it would be nice to use only KDE4 apps eventually.&lt;br /&gt;&lt;br /&gt;On another note, Eigen2 development has been very fast recently, but more on this later -- for now the top priority for us all should be to help as we can to get 4.0 in shape, and Eigen2 will only be used in KDE 4.1 and KOffice 2.1. So I try to compensate for my current non-contribution to the 4.0 effort by doing some beta-testing, bug-reporting, and encouraging you all to do so :)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:3333</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/3333.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=3333"/>
    <title>Eigen2 restart from scratch</title>
    <published>2007-09-05T13:08:44Z</published>
    <updated>2007-09-05T13:08:44Z</updated>
    <content type="html">On saturday I decided that after all TVMET wasn't the appropriate starting point for Eigen2, so I restarted Eigen2 from scratch.&lt;br /&gt;&lt;br /&gt;I started coding on Sunday, and today I made the initial commit to KDE's SVN in w &lt;a href="http://websvn.kde.org/branches/work/eigen2/"&gt;/branches/work/eigen2&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'm very happy about how things have been going since this restart. The basics are already there. Eigen2 already has matrices and vectors, both fixed-size and dynamic-size (reusing the CRTP trick from Eigen1), and of course &lt;a href="http://ubiety.uwaterloo.ca/~tveldhui/papers/Expression-Templates/exprtmpl.html"&gt;expression templates (ETs)&lt;/a&gt;. Non-square matrices are handled, and the ETs can be lvalues, not just rvalues.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:3248</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/3248.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=3248"/>
    <title>The long road to Eigen 2</title>
    <published>2007-08-26T07:52:04Z</published>
    <updated>2007-08-26T07:52:04Z</updated>
    <category term="kde eigen eigen2 tvmet c++ matrix librar"/>
    <content type="html">It's funny how none of the existing libraries for vector and matrix math seems to do all what one might want. Each of these libs (Blitz++, MTL, LAPACK, GSL, TVMET, GMM++...) is specialized for certain needs. Usually, an app will choose the most suitable one for its needs, and be happy. But KDE is a huge meta-project with lots of sub-projects, so it has a very broad range of mathematical needs, which is not covered by any of the specialized libraries.&lt;br /&gt;&lt;br /&gt;Writing from scratch such a general math library would take many man-years. However, what one can do is to merge existing libraries into a single one.&lt;br /&gt;&lt;br /&gt;A killer feature that we absolutely want is &lt;a href="http://ubiety.uwaterloo.ca/~tveldhui/papers/Expression-Templates/exprtmpl.html"&gt;expression templates&lt;/a&gt;. It's a strange C++ technique that allows to do things like a = b + c without paying the cost of having a temporary object allocated on the stack and then copied into a. Basically, it allows to use natural mathematical notation without any overhead. It even allows things like &lt;pre&gt;matrix.row(i) += matrix.row(j)&lt;/pre&gt; which would be impossible otherwise.&lt;br /&gt;&lt;br /&gt;The best expression templates for a matrix library are currently found in &lt;a href="http://tvmet.sourceforge.net"&gt;TVMET&lt;/a&gt;. Unfortunately, TVMET has been stagnant for 2 years and has been very little used by other projects, which is probably due to being too abstract, aiming too much for theoretical perfection.&lt;br /&gt;&lt;br /&gt;For Eigen2, I decided to use TVMET as my starting point, instead of &lt;a href="http://eigen.tuxfamily.org"&gt;Eigen1&lt;/a&gt;. Of course, the contents of Eigen1 will be incorporated into Eigen2 as soon as possible. However, for now my work has been focused in shaping TVMET for my needs. I've converted it from autotools to CMake, and I've removed tons of stuff that I don't need, shrinking it down from 12000 to 7000 lines of code, and I've still room to shrink it further, and I've already added some good stuff from Eigen1, such as sane fuzzy comparisons. I'm currently porting the unit-tests from CPPUnit to QTestLib, and by the way I'm improving them a lot now that there are sane fuzzy comparisons.&lt;br /&gt;&lt;br /&gt;What's next? Once I'll have fully reshaped TVMET and incorporated Eigen1 into it, I'll have a working Eigen2 for tiny (i.e. fixed-size) vectors and matrices. For dynamic-size objects, both dense and sparse, I'll wrap &lt;a href="http://home.gna.org/getfem/gmm_intro"&gt;GMM++&lt;/a&gt;. In order to make this possible, the expression templates from TVMET will have to be adapted, as for instance loop unrolling will no longer be possible.&lt;br /&gt;&lt;br /&gt;It's a very exciting project that is bound to fill a very bad gap in the current existing software. It requires only knowledge of pure C++, and vague notions of matrix mathematics. Your help is more than welcome, as there's a lot to do. So don't hesitate, join me: eigen at lists tuxfamily org.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:3071</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/3071.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=3071"/>
    <title>[Kalzium] Icon status</title>
    <published>2007-06-17T11:11:40Z</published>
    <updated>2007-06-17T18:46:24Z</updated>
    <category term="kalzium icons svg"/>
    <content type="html">Carsten asks me to blog for him as PlanetKDE lost his blog:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Moin&lt;br /&gt;&lt;br /&gt;Many new icons got in as well as some new features. Here you can see the new Short Table which is used a lot in (german) schools. As you can see some icons are missing and some need to be tweaked. But in general it already looks quite nice. All icons are rendered directly from SVG by the way!&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/capture19.png" border="0" alt="Free Image Hosting at www.ImageShack.us" /&gt;&lt;br /&gt;&lt;br /&gt;Let me add that a new artist recently joined us and started contributing icons to Kalzium: Noémie Scherer. On the above picture, at least the icons for B, C, P, I are by her. She also draw icons for other elements that don't appear on this Short Table.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update:&lt;/b&gt; Screenshot updated. Due to bad CMakelists some icons were not displayed. Also the image was scaled which was bad.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:2810</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/2810.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=2810"/>
    <title>Drawing shadowed text inside an OpenGL scene</title>
    <published>2007-05-08T18:32:07Z</published>
    <updated>2007-05-08T18:34:45Z</updated>
    <category term="opengl shadowed text qt avogadro libavog"/>
    <content type="html">I've been quiet lately, partly because I've had to spend most of my time on my thesis, and partly because I've done all my coding in Avogadro (no real website yet), which is not yet in KDE's SVN. If you read &lt;a href="http://dot.kde.org/1170113778/"&gt;this story&lt;/a&gt; showing the new Kalzium3D features, maybe you'll be interested to know about libavogadro. This library initially took the kalzium3D rendering code but set much more ambitious goals, with currently 4-8 hackers including a promising &lt;a href="http://code.google.com/soc/kde/appinfo.html?csaid=3EBDFAAF85EFFA00"&gt;SoC&lt;/a&gt;. There are immediate plans to port Kalzium to libavogadro; however libavogadro won't reach API stability in time for KDE 4.0 so we'll probably import a snapshot inside the Kalzium tree in the next days.&lt;br /&gt;&lt;br /&gt;A new thing that libavogadro does is to draw labels on atoms. Rendering text inside an OpenGL scene is not straightforward. The problem is that in an opengl scene, you typically can't control the color of background. And if the text color is too close to the background color, then it's not readable. A bad workaround is to paint a semi-transparent dark rectangle behind the text. But in many occurences that feels ugly.&lt;br /&gt;&lt;br /&gt;So a better solution is to draw a black shadow around the text. Just like the text below the icons on your KDE 3.5 desktop background. AFAIK, Qt does not yet provide that functionality, which is why KDesktop has &lt;a href="http://websvn.kde.org/trunk/KDE/kdebase/workspace/kdesktop/kshadowengine.cpp?view=log"&gt;its own code for that&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I initially tried to do it with QGLWidget::renderText, achieving the shadow by painting the text multiple times. Alas, renderText is not very fast, and multiple renderText calls are even slower. I got something working, but the framerate was divided by a factor of 5 (with Qt 4.2.3 and 4.3-b1). Too slow!&lt;br /&gt;&lt;br /&gt;So I took my &lt;a href="http://lists.trolltech.com/qt-interest/2006-07/thread00093-0.html"&gt;old TextRenderer class&lt;/a&gt; that I had written for Kalzium, and improved it to do shadowed text. This was achieved as follows: use a 16bpp GL_LUMINANCE_ALPHA texture, paint with Qt the character and read the luminance channel directly from the resulting bitmap; while the alpha channel is obtained by applying a trivial convolution filter (much like what KDesktop does, see above link). Characters are rendered on the fly whenever they are first needed, and are then cached and managed in a QHash.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://avogadro.svn.sourceforge.net/viewvc/avogadro/trunk/libavogadro/src/textrenderer.cpp?view=log"&gt;The code&lt;/a&gt; is in avogadro's SVN tree at sourceforge but it's still very unclean and comments/docs are missing.&lt;br /&gt;&lt;br /&gt;Obligatory screenshot (see how the shadow is necessary for readability on the white Hydrogen atoms):&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/capture9.png"&gt;&lt;/img&gt;&lt;br /&gt;&lt;br /&gt;This 35 frames-per-second is on my laptop with software-only rendering (mesa-swx11) and the highest level of detail. Disabling the labels on the atoms only increases the framerate by +10%, which is not too much if you consider how slow texture-mapping is on software-only systems.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:2410</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/2410.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=2410"/>
    <title>Eigen 1.0</title>
    <published>2006-12-30T20:21:41Z</published>
    <updated>2006-12-30T20:21:41Z</updated>
    <category term="eigen"/>
    <content type="html">&lt;a href="http://eigen.tuxfamily.org"&gt;Eigen 1.0&lt;/a&gt; is released! This project started in July when we (that is, a handful of KDE developers) realized that we had a common need for some math functionality that no library out there seemed to cover reasonably. Sure, there are many linear algebra libraries, but they are either too small/amateurish, or too big/professional and focusing on heavy scientific stuff that we don't need. People objected (rightly) that adding a big dependency would be frowned upon by distro maintainers. So we decided to start our own linear algebra library, Eigen.&lt;br /&gt;&lt;br /&gt;5 monthes later, it's there. If you're looking for a lightweight library for vectors, matrices and related math stuff, please give it a try. We have fixedsize classes, as in "float v[SIZE];" and they're very fast and specially optimized for low sizes (&amp;lt;=4). We also have dynamic-size classes, which can be useful if you're developing e.g. a spreadsheet and want to be able to solve any system of arbitrarily many linear equations. And we have special classes for projective geometry, which can be useful in OpenGL apps, as was demonstrated in my &lt;a href="http://bjacob.livejournal.com/2055.html"&gt;previous entry&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;By the way, and Eigen is very fast with GCC, whereas some other linear algebra libraries will tell you to use the intel compiler instead. The issue here is that GCC has problems with loop unrolling. In particular, GCC often fails to unroll nested for loops, which is annoying e.g. for matrix product, see &lt;a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30201"&gt;this bug report&lt;/a&gt;. In Eigen, this problem is worked around by manually unrolling loops in fixed-sizes up to 4 (which are the cases where loop unrolling is wanted).</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:2055</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/2055.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=2055"/>
    <title>Eigen example: the OpenGL camera problem</title>
    <published>2006-12-29T15:43:16Z</published>
    <updated>2006-12-29T15:58:01Z</updated>
    <category term="eigen opengl"/>
    <content type="html">It looks like &lt;a href="http://eigen.tuxfamily.org"&gt;Eigen&lt;/a&gt; 1.0 will be out in 2006 as promised. For this occasion, I have fixed a small example program. Since the beginning, one of the primary goals of Eigen has been to provide the math functionality that is useful in OpenGL apps. And one of the most common problems when writing OpenGL apps is, how to let the user freely move the camera around? Representing the camera orientation by 3 angles just doesn't work, and leads to the &lt;a href="http://en.wikipedia.org/wiki/Gimbal_lock"&gt;gimbal lock&lt;/a&gt; problem. So the best solution is to represent the camera position and orientation by a 4x4 matrix and pass it directly to OpenGL. The question is then, how to generate this matrix from the user input? This is where Eigen comes into play. Here is the GLWidget::mouseMoveEvent() function from the &lt;a href="http://websvn.kde.org/trunk/kdesupport/eigen/examples/qt/"&gt;Eigen example program&lt;/a&gt;:&lt;br /&gt;&lt;pre&gt;
void GLWidget::mouseMoveEvent( QMouseEvent *event )
{
    QPoint delta = event-&amp;gt;pos() - m_lastPos;
    m_lastPos = event-&amp;gt;pos();
    if( event-&amp;gt;buttons() &amp; Qt::LeftButton )
    {
        m_cameraMatrix.prerotate3( - delta.x() * ROTATION_SPEED, AXIS_Y );
        m_cameraMatrix.prerotate3( - delta.y() * ROTATION_SPEED, AXIS_X );
    }
    if( event-&amp;gt;buttons() &amp; Qt::RightButton )
    {
        m_cameraMatrix.prerotate3( - delta.x() * ROTATION_SPEED, AXIS_Z );
        m_cameraMatrix.pretranslate( delta.y() * TRANSLATION_SPEED * AXIS_Z );
    }
    if( event-&amp;gt;buttons() &amp; ( Qt::LeftButton | Qt::RightButton ) )
        update();
}
&lt;/pre&gt;&lt;br /&gt;This lets the user rotate around by drag &amp; drop with the left mouse button, and tilt and move forwards/backwards by drag &amp; drop with the right mouse button. Then the paintGL function looks like&lt;br /&gt;&lt;pre&gt;
void GLWidget::paintGL()
{
    glLoadMatrixd( m_cameraMatrix.array() );
    drawScene();
}
&lt;/pre&gt;&lt;br /&gt;Obligatory screenshot:&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/capture6.png"&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:1992</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/1992.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=1992"/>
    <title>Bruce Perens's open letter to Novell's CEO</title>
    <published>2006-11-22T21:59:38Z</published>
    <updated>2006-11-22T21:59:38Z</updated>
    <category term="bruce perens novell ms"/>
    <content type="html">Bruce Perens has just posted this petition:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://techp.org/petition/show/1"&gt;Protest the Microsoft-Novell Patent Agreement&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:1762</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/1762.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=1762"/>
    <title>First benefits of using Eigen for Kalzium</title>
    <published>2006-11-17T09:23:14Z</published>
    <updated>2006-11-17T19:05:32Z</updated>
    <category term="kalzium 3d eigen kde"/>
    <content type="html">In &lt;a href="http://edu.kde.org/kalzium"&gt;Kalzium&lt;/a&gt;'s 3D viewer, a problem was that when you loaded a molecule, the default viewpoint was not always optimal, sometimes totally unreadable. For instance, look at this molecule of &lt;a href="http://en.wikipedia.org/wiki/Tryptophan"&gt;L-tryptophan&lt;/a&gt; :&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/capture3.png" alt="L-tryptophan, bad viewpoint"&gt;&lt;br /&gt;Of course, Kalzium always allowed to freely rotate around the molecule, so after some mouse effort, you could get that:&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/capture4.png" alt="L-tryptophan, bad double bonds orientation"&gt;&lt;br /&gt;But then, a second problem appears: depending on the viewing angle, double bonds can look like single bonds. In the above pic, one should see 6 double bonds. This even mislead some people into believing that our molecule files were wrong! So I sat down and figured that the first thing to do was to perform a linear regression to compute the best-fitting plane for the molecule. Once we know that plane, elementary geometry allows to find a nice viewpoint and to orient the multiple bonds in a convenient way. So I implemented linear regression and a computeFittingHyperplane function in &lt;a href="http://eigen.tuxfamily.org"&gt;Eigen&lt;/a&gt;, and reworked Kalzium's 3D viewer to make use of it. Result:&lt;br /&gt;&lt;img src="http://download.tuxfamily.org/eigen/capture5.png" alt="L-tryptophan, nice viewpoint, nice double bonds :)"&gt;&lt;br /&gt;I haven't had to do any manual rotation for this screenshot, this is the exact viewpoint you get when you load the molecule. Also note that now the 6 double bonds clearly appear. Maximizing the window, I got &lt;a href="http://download.tuxfamily.org/eigen/capture2.png"&gt;this&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;About speed: for these screenies, I take the high-quality mode, and get 56 FPS on my software-only (no hardware acceleration) 1.66 GHz Intel Core 1. In low-quality mode, I get 178 FPS, and at this window size, the visual difference is not too big. Even on Carsten's laptop, it runs OK ;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update:&lt;/b&gt; as a comment pointed out, the molecule file is wrong, there is one hydrogen atom missing and one double bond too much. This was a bug in the (very old) molecule file that I used, and has been fixed since in the BlueObelisk project.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:1395</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/1395.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=1395"/>
    <title>Some lines by Levinas that apply to Software</title>
    <published>2006-11-16T09:16:49Z</published>
    <updated>2006-11-16T14:23:35Z</updated>
    <category term="levinas free software"/>
    <content type="html">Here's a rough translation of a few lines from Levinas's 1934 essay, &lt;a href="http://www.anti-rev.org/textes/Levinas34a/"&gt;Quelques reflexions sur la philosophie de l'hitlerisme&lt;/a&gt; (3 paragraphs to the end) :&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;An idea, by propagating, detaches from its starting point. It becomes, despite the unique accent given by its creator, a common good. It is anonymous. The one who accepts it becomes its master as much as the one who proposed it. Thus, the propagation of an idea creates a community of "masters" -- it is an equalization process. To convert, or to convince, is to create oneself peers. The universality of an order in the occidental society always reflects this universality of truth.&lt;br /&gt;&lt;br /&gt;But force is characterized by another kind of propagation. The one who exercises it doesn't detach from it. Force doesn't dilute into those who are subjected to it. It remains attached to the personality or society who exercises it, widening them while subjecting the rest to them.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now replace "idea" by "Free Software" and "force" by "Non-Free Software".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update&lt;/b&gt;: improve translation, replace "strength" with "force".</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:1198</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/1198.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=1198"/>
    <title>Eigen 0.9.3, new website, mailing list</title>
    <published>2006-11-15T11:18:45Z</published>
    <updated>2006-11-15T11:34:49Z</updated>
    <category term="eigen"/>
    <content type="html">Eigen 0.9.3 was released today with important compilation fixes. Because Eigen is templates, compilation problems are difficult to detect, so before the next release I'll add unit-tests specifically for that.&lt;br /&gt;&lt;br /&gt;The new permanent website of Eigen is here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://eigen.tuxfamily.org"&gt;http://eigen.tuxfamily.org&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also we got a mailing list: eigen at lists tuxfamily org. To subscribe, send a mail with subject "subscribe" to eigen-request at lists tuxfamily org.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:855</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/855.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=855"/>
    <title>Eigen 0.9.2</title>
    <published>2006-11-12T19:06:46Z</published>
    <updated>2006-11-12T20:08:23Z</updated>
    <category term="eigen"/>
    <content type="html">Eigen 0.9.2 is &lt;a href="http://www.math.jussieu.fr/~jacob/eigen/"&gt;here&lt;/a&gt;. Lots of sparse improvements since 0.9.1, plus one "big" feature: functions for &lt;a href="http://en.wikipedia.org/wiki/Linear_regression"&gt;linear regression analysis&lt;/a&gt;. I've been careful to write &lt;a href="http://www.math.jussieu.fr/~jacob/eigen/group__regression.html#g586fbb868c5c431f6c4c37b5362e5fc8"&gt;hopefully good documentation&lt;/a&gt; for that. By the way, did you know that doxygen allows to use LaTeX to produce png's of math formulas?&lt;br /&gt;&lt;br /&gt;Eigen got a &lt;a href="http://www.math.jussieu.fr/~jacob/eigen/"&gt;new website&lt;/a&gt;, entirely doxygen-generated. Because it's doxygen-generated, it would probably not be a good idea to host it in KDE's SVN, so I'm registering a project at &lt;a href="http://www.tuxfamily.org"&gt;TuxFamily&lt;/a&gt;. But there really are some good sides with using doxygen to create a website. For instance, the LateX png feature provides a cool way to show e-mail addresses while protecting them from spam!&lt;br /&gt;&lt;br /&gt;On the cool side, it seems that one &lt;b&gt;big&lt;/b&gt; scientific (non-mathematical) Free software project is considering moving to Eigen ! I'll handle the porting soon and will let you know once it's official :)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:721</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/721.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=721"/>
    <title>Havoc Pennington on the Novell/MS agreement</title>
    <published>2006-11-08T10:26:31Z</published>
    <updated>2006-11-08T10:32:10Z</updated>
    <category term="novell ms havoc pennington"/>
    <content type="html">I'd like to draw your attention on this blog post, which I found interesting:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://log.ometer.com/2006-11.html#7"&gt;http://log.ometer.com/2006-11.html#7&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In particular, he argues that the &lt;a href="http://www.novell.com/linux/microsoft/faq_opensource.html"&gt;Novell FAQ&lt;/a&gt; "tries to weasel out the spirit of the GPL". I tend to agree with him, but I don't have the necessary knowledge to have strong opinions on this issue.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:bjacob:407</id>
    <link rel="alternate" type="text/html" href="http://bjacob.livejournal.com/407.html"/>
    <link rel="self" type="text/xml" href="http://bjacob.livejournal.com/data/atom/?itemid=407"/>
    <title>Eigen : let your apps do the math !</title>
    <published>2006-10-21T16:56:19Z</published>
    <updated>2006-10-21T17:56:15Z</updated>
    <category term="kde eigen"/>
    <content type="html">Eigen 0.9.1 has been released today. It's a lightweight C++ template library for linear algebra: vectors, matrices, solving systems of equations...&lt;br /&gt;&lt;br /&gt;

Eigen provides:&lt;br /&gt;
 * classes for vectors and matrices, in two versions: fixed-size and dynamic-size. The fixed-size classes are zero-overhead and never cause dynamic memory allocations. The dynamic-size classes provide better flexibility. Both versions use the same C++ code, thanks to a C++ trick known as the &lt;a href="http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern"&gt;Curiously Recurring Template Pattern&lt;/a&gt;.&lt;br /&gt;
 * classes for easy solving or systems of linear equations. Again, both fixed-size and dynamic-size versions are provided.&lt;br /&gt;
 * classes for directly handling LU decompositions.&lt;br /&gt;&lt;br /&gt;

Kalzium has already been ported to Eigen, which will allow for more 3D coolness in the molecule viewer. A handful of other KDE apps are also considering using it. But, as Eigen is pure C++ with no dependency at all, it could very well be used by non-KDE apps, which is why we put it in trunk/kdesupport.&lt;br /&gt;&lt;br /&gt;

We plan on a 1.0 release within one month. To all app developers with a need for some math functionality : now's the time to give Eigen a try!&lt;br /&gt;&lt;br /&gt;

Website: &lt;a href="http://edu.kde.org/kalzium/eigen/index.php"&gt;http://edu.kde.org/kalzium/eigen/index.php&lt;/a&gt; &lt;br /&gt;
API documentation: &lt;a href="http://www.math.jussieu.fr/~jacob/eigen/dox/"&gt;http://www.math.jussieu.fr/~jacob/eigen/dox/&lt;/a&gt; &lt;br /&gt;
Source code: &lt;a href="http://websvn.kde.org/trunk/kdesupport/eigen/"&gt;http://websvn.kde.org/trunk/kdesupport/eigen/&lt;/a&gt; &lt;br /&gt;
IRC: #eigen on freenode&lt;br /&gt;&lt;br /&gt;

&lt;a href="http://digg.com/software/New_math_library_Eigen_0_9_1_released"&gt;Digg this entry&lt;/a&gt;</content>
  </entry>
</feed>
