Commit #5

Been a long time since I gave some effort to this. Coded the gmath class, which defines math constants and basic functions (see this link).

I coded this as a plain .h file, and I realized this would be a good thing to do for the entire project. Since I’m only wrapping and not implementing anything, it’ll be much faster, I don’t have to bother with Makefiles (except for tests), and the user doesn’t have to compile anything.

I’ll write the next couple of modules and test them out as plain .h files and then perhaps convert the gcomplex class into fully .h as well.

Going live

The project is now live at http://code.google.com/p/gslcpp/. You can check out the sources through anonymous SVN by:

svn checkout http://gslcpp.googlecode.com/svn/trunk/ gslcpp

As of now there is just one class that I’ve implmented – gcomplex that wraps around gsl_complex data and functions.

A wrapper, for now

For now, gslcpp will be a wrapper around GSL, i.e. it will provide a C++ object oriented interface for GSL datatypes and functions, but will call GSL for much of its functionality. The reasons:

  • I’m lazy, and implementing a wrapper is easier; even copying implementation source over might introduce problems that I’m not willing to deal with right now.
  • My problem with GSL is the interface, not the implementation, and making a wrapper allows me to tackle the interface with minimal focus on the underlying implementation.
  • I lack the technical knowledge to actually implement, or solve re-implementation problems with all of the highly mathematical GSL functions.
  • A wrapper can more easily take advantage of any improvements in GSL that come along.

There are some reasons, however, to consider making gslcpp a self-contained implementation at a later stage:

  • Performance. There will be some performance loss by calling an external library. And a self-contained C++ interface may allow better optimization
  • The GSL homepage suggests that the library is considered feature complete and the authors do not intend to continue any active development.

Why gslcpp

I’ve used the GNU Scientific Library (GSL) on more than one occasion in my graduate studies in Bioinformatics, and I think it’s a really cool library. It has many strong points – a great feature set, fast code, clean interface and great documentation, and most importantly, it’s free software. Which a great boon students like me who have virtually no access to proprietary libraries.

I do most of my code in C++. Although I think that the while the authors have done a great job in keeping the library object-oriented, the limitations of the C-based interface become apparent when a C++ program uses the library heavily – one often needs to allocate and deallocate memory (for vectors and matrices), simple operations require long procedure names (gsl_complex_add_real for example), different functions are used for different types (gsl_vector_int_add vs. gsl_vector_complex_add) and so on.

All this led me to think that it would be useful to have a C++ implementation of GSL, and I have started to write one.

This site is intended as a log of progress, musings, and interactions about development of this project, which I have decided to call GSL for C++ or gslcpp.

Follow

Get every new post delivered to your Inbox.