Title: Using Ruby/GSL

1 Installation

See here.

2 Load the library

Put at the head of your scripts,

require("gsl")

The GSL module is automatically included by default, i.e. you can simply write as v = Vector[0..5] to create an instance of the GSL::Vector class. If you don't like the auto-include, use require("rbgsl") instead. You cannot omit the identifier GSL:: in this case.

3 Naming conventions, C Structs and Ruby Classes

Most of GSL data types, functions or constants are named as gsl_xxx or GSL_XXX. In Ruby/GSL, the prefix gsl_ is replaced by the module identifier GSL::, where GSL is the top level module of Ruby/GSL, and the Ruby classes are defined for each of the GSL C structs under the GSL module. According to the Ruby manner, the name of each class begins with a capital. For example,

4 Sample scripts

See the directories "samples/" and "tests/".

Some of the examples use the graph utility to show the results. The graph utility is included in the GNU plotutils package. Windows-cygwin binaries of GNU plotutils and related packages are available from here.

5 Modules and Classes

The following is the list of Ruby/GSL modules and classes, <Name> (<Module or Class>)

prev next

Reference index top