Transforming the CLR to numerical applications, and the nullspace that results.

Wednesday, July 30, 2008

A Money Type for the CLR

Treatment of numbers on the CLR lead me to an interesting lack in the Base Class Libraries... there is no money type.

I've done a bit of reading and research and produced what I hope is a work which addresses not only the issues which have already been cataloged with this particular type pattern, but also some nuances of implementing it on the CLR.

The article is on CodeProject, and the code base is hosted on CodePlex.

Comment and criticism welcome.


Wednesday, July 2, 2008

Generate AssemblyInfo.cpp for C++/CLI

I manage a number of C++/CLI projects (which, for the most part, is a decent language extension, contrary to the expected detractors' views). For my C# projects, I enjoy being able to create the AssemblyInfo.cs file on the fly from properties I store in my SVN repository. It allows me a sort of "poor man's product management" where I can manage product name, description and major.minor version in one place, versioned along with the code.

This was easy using NAnt. I've recently been moving to MSBuild and have been sharing the same sort of view as my former colleague Travis Illig: NAnt is way more flexible and easy out of the box. On the other hand, as Scott points out in that post, much of it is a matter of learning the "MSBuild way" where Tasks and Targets are much more independent as well as adding some custom tasks to replace the missing ones from NAnt.

Enter the very nice collection called MSBuild Community Tasks. It filled in for the AssemblyInfo task I loved in NAnt. However, I got no such love from it for C++/CLI. MSBuild Tasks are quite easy to create, however (easier, even, than NAnt tasks, since fewer attributes are needed). I looked over the source for the custom AssemblyInfo task, and found it to be very easy to modify. Taking advantage of the CppCodeProvider which is new for .Net 2.0, I added C++/CLI support to it, added some tests, and contributed the patch back to the project. Paul Welter reviewed and applied it astonishingly quickly. Something I could learn from for SharpMap (before you complain, however, notice I said I included tests and a patch file ;) )...

So, if you're looking for an AssemblyInfo.cpp generator, or a number of other useful custom tasks, look no further than the well-tended MSBuild Community Tasks project.

Tuesday, June 24, 2008

Source Diff: Build SSCLI2.0 (Rotor) in VS 2008

For the Rotor fans out there who don't want to install VS 2005 on their new machines, I followed Jeremy Kuhne's excellent step-by-step instructions to produce a source tree diff which will get you up and going fast.

Thursday, May 8, 2008

Salvia - a drug to help with understanding projective geometry?

I've been working hard to get a good grasp on projective geometry - reading as much as I can on as well as purchasing what appears to be a key exposition for beginners - The Geometry of Incidence by Harold L. Dorwart.

However, it is quite a bit of work to get the brain to accept projective space. Understanding linear projection of vectors via the dot product was hard... projective geometry is a new level of hard.

There seems to be hope, though... a drug called Salvia which is becoming quite the buzz (no pun intended).

From a Slate article:

"Generally, smoked salvia effects come on quickly, peak for 5-20 minutes, and then begin to subside," the FAQ notes. Users report visions; feelings of fright; loss of physical coordination; uncontrollable laughter; confusion; feelings of being underground, or underwater, or flying, or floating; experiences of "non-Euclidean" spaces; and more, according to Erowid.

Experiences of non-Euclidian spaces? Like, perhaps "projective spaces"? Just what I've been searching for! Need to check if it is legal in my state...

Saturday, April 5, 2008

Intel announces next-generation SSE: AVX

I got an email from Intel yesterday, announcing what amounts to 256-bit SSE instructions. They call it AVX for Advanced Vector eXtensions. I presume this going to eventually rely on the forthcoming technology currently code-named Larrabee, which seeks to push the CPU and GPU closer together and addressable with everyday tools, unlike having to write DX shaders, or use some special C++-like language (e.g. Brook or CUDA). Doing a little sleuthing turns up some hack's report on the spring IDF which mentions that AVX will be a post-Nehalem (Sandy Bridge) CPU feature. However, I suspect we'll see more of a CPU-GPGPU blend once Nehalem is out.

The only thing I can really get my hands on right now is a marketing site:, which has some interesting PDFs about how you can use these extensions, but no engineering samples to give away. Why not?

AVX should make graphics more fun, since we can pack 4 doubles into a register and do a matrix multiply on it. Since 4 doubles makes a 3D coordinate in projective space, highly accurate spatial processing should get a lot faster.

On a related note, I hope to get a Penryn soon, and will be able to finally use the DDOT SSE4.1 instruction on some vertex data. Projections should get a lot faster... we'll see!

Tuesday, March 4, 2008

MS Releases the Singularity (Managed OS) Research Dev Kit!

I was just daydreaming about what it would be like to write managed drivers over this past weekend...

What a treat!

Tuesday, February 12, 2008

Using SSE2 to sort numbers

I created an article on CodeProject which describes the SSE2 Bubble Sort I came up with. I hope that SSE2 will be a big help in computing some of the line intersections in NetTopologySuite. We'll have to see, however, since SSE2 math is different than x87 math (64 bit vs. 80 bit). By using a fixed or integer precision model, this problem should be avoided.