[Kalzium] Linear algebra library

Inge Wallin inge at lysator.liu.se
Thu Jul 27 16:14:31 CEST 2006


On Wednesday 26 July 2006 20.41, Benoît Jacob wrote:
> 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/

After a length discussion on IRC, where size considerations were raised over 
GSL, ublas, and other comprehensive, but big libraries, it was decided to 
look into actually including a small library into the apps.  An alternative 
would be to try to get it into kdelibs or even Qt, but that is a longer term 
venture.

Naturally it's madness to write a small matrix / linalg library from scratch 
since that has been done 100s of times. So I dug out some old code of mine 
and a friends that was used in a graphics library called SiPP, the Simple 
Polygon Processor.

Here it is, it's C not C++, it is funnily indented, but it's very well tested, 
it's fast and it's readable. It should be easy both to C++-ify and to extend 
with some needed functions. Do with it what you want.

	-Inge


> 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
> _______________________________________________
> Kalzium mailing list
> Kalzium at kde.org
> https://mail.kde.org/mailman/listinfo/kalzium

-- 
Inge Wallin               | Thus spake the master programmer:               |
                          |      "After three days without programming,     |
inge at lysator.liu.se       |       life becomes meaningless."                |
                          | Geoffrey James: The Tao of Programming.         |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geometric.c
Type: text/x-csrc
Size: 10780 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kalzium/attachments/20060727/dfa4fd53/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geometric.h
Type: text/x-chdr
Size: 5507 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kalzium/attachments/20060727/dfa4fd53/attachment-0003.bin 


More information about the Kalzium mailing list