[Kalzium] Proposal : use GSL/GSL-- for the linear algebra stuff

Benoît Jacob jacob at math.jussieu.fr
Wed Jul 26 20:41:29 CEST 2006


Hi,

after receiving many suggestions, especially in comments on Carsten's blog, 
and also googling a lot, I evaluated several linear algebra packages, and my 
feeling is that we should use GSL, the GNU Scientific Library:

http://www.gnu.org/software/gsl/

it looks very well-done, provides all what we might possibly need (not only 
linear algebra, but a lot more math stuff), is widely used, and is portable:
http://www.gnu.org/software/gsl/#platforms

Under Windows, is it OK to use minGW or Cygwin ? Or is it necessary to only 
use libs that can be compiled with MSVC++? In that case, according to this 
link:

http://www.mail-archive.com/bug-gsl%40gnu.org/msg00151.html

it should be possible to build with MSVC++ .Net or later versions, but one 
might be out of luck with MSVC++ 6.0 (not sure).

Other options included Boost/uBLAS, but unfortunately it doesn't have enough 
features so we'd end up reinventing the wheel very often. For instance it 
can't compute eigenvectors. Another option was TNT/JAMA++, but its website 
wasn't very comforting, with the source code only available as a .zip 
archive... Other small projects like Newmat looked good but we're looking for 
a big well-tested project aren't we, if we ever want to propose to OpenBabel 
to use it.

The only drawback of GSL is that it's C-only. Fortunately, there are some C++ 
wrappers for GSL out there. The one that looks most promising and actively 
developed is GSL--:

http://cholm.home.cern.ch/cholm/misc/#gslmm

I emailed its author, who told me it's currently 25% complete, adding that 
he'd be glad to accept patches. I think that such patches should be easy to 
write as it's only wrapper stuff, the functions themselves are already 
provided by GSL.

So here's what I propose to do:

0) I'll be away from July 30 to August 12, so I'll only start then.
1) Begin using GSL functions in Kalzium where needed, for instance to compute 
the plane best approximating n atoms.
2) Port that to GSL--, sending patches to GSL-- as required.
3) Completely port Kalzium to GSL--, again sending patches to GSL-- as 
required. That means for instance that instead of using OpenBabel's vector3 
class, we'd now use its equivalent in GSL--.
4) Propose to OpenBabel patches turning the vector3, matrix3x3, ... classes 
into wrappers around GSL-- stuff. Using C++ inheritance, we could do that 
while preserving compatibility. For instance, momentarily call GSL::vector3 
the class in GSL-- that represents a 3d vector of doubles. Then we could 
replace OpenBabel::vector3 by

class OpenBabel::vector3 : public GSL::vector3
{
	// here, add the methods that are in the current OpenBabel::vector3
	// class, but that are not in GSL::vector3, like createOrthoVector

	// for many methods, like the operators, there should be nothing to
	// do, though
}

What do you think? This way Kalzium and/or OpenBabel wouldn't have to worry 
anymore about math stuff, risk of floating-point violations, etc...

Cheers,
Benoit


More information about the Kalzium mailing list