ccgsl  1.16.1
ccgsl Documentation

The ccgsl package is designed to provide simple C++ wrappers for the GNU Scientific Library.It grew out of some practical classes designed to make GSL a little easier to use without changing its basic features. It is not meant to be an object oriented version of GSL. Rather it tries to keep most of the efficiency of GSL while letting a C++ compiler simplify the creation and destruction of GSL structs. It also allows better interaction with the C++ standard template library and optionally changes errors into C++ exceptions.

Much of the package is created using Ruby scripts to rewrite the GSL header files.

Here are some of the features of ccgsl.

  • The only installed files are header files. This means that no extra libraries need to be installed to get ccgsl to work. Just link the gsl libraries as usual.
  • Structs that have _alloc() and _free() functions are replaced with classes that behave like Java classes of boost shared pointers. They are lightweight shared handles that should be created as automatic variables. When one of these classes goes out of scope, it deletes the struct it points to automatically unless it is shared by another class.
  • The ccgsl classes can be used safely and efficiently inside STL containers. So, for example, std::list<gsl::vector> and std::vector<gsl::rng> work properly.
  • The vector and block classes are STL containers. So you can use the STL algorithms with them.
  • Most GSL functions are reimplemented in ccgsl namespaces and have nearly the same form as the corresponding GSL function. So, for example, gsl_sf_gamma() becomes gsl::sf::gamma() with the same parameters. Replace pointers to GSL structs with references to ccgsl classes.
  • You can mix GSL functions freely with ccgsl. The get() function of a ccgsl class gives a GSL pointer. So, for example gsl::vector::get() returns a gsl_vector* object.
  • ccgsl can turn on exceptions instead of GSL errors. Thus you can use the simpler form of many functions within a try block instead of testing the result of a function call with an extra parameter. See the gsl::exception class for details.