Hi Ruby world.
I am attaching some pieces of an email conversation I had with Yoshiki
Tsunesada regarding his excellent work rb-gsl. I wanted to start a
discussion about what extensions would make Ruby an intuitive and
powerful math language; I think he has already laid the foundation,
but there are some important pieces that we could add, especially in
the realm of indexing and assigning to matrices (and possibly in the
realm of graphics too). Feel free to comment
···
**********
Yoshiki said:
As mentioned in ruby-talk, by Nobu Nakada, the C coding
in Ruby/GSL seems to be somewhat "old-fashioned". My excuse
is that I studied Ruby-C API in ruby-1.4 ages, and I just
followed a "framework" explained in a Ruby textbook
written in that days. I have not followed the current
framework, although I still don't know what is the
"franework".
Because of this, it is impossible to create a subclass
of a Ruby/GSL class in a Ruby script, while still possible
in C. The definition of the singleton method "new" in C
is the problem, but I don't know how to improve it
(for all the classes in Ruby/GSL). Sorry for inconvenience.
This problem must be improved in a future version of Ruby/GSL,
to be extensible easily from Ruby, not from C.
You can still implement your new interfaces using C API,
but you may not prefer it. If you show all your requests
you want to do in Ruby/GSL, I will code them in C. I want
to put aside the framework problem for a while, since
it is rather messy to change the coding all for the classes.
********
I replied:
I wish I was a better programmer and could implement my extensions in
ruby-gsl's C.
My extensions involve array indexing and assignment, but if you are
interested in improving the usability of rb-gsl, you might want to look
at Octave (http://www.octave.org) which is kind of a gnu matlab.
S-Plus/R (http://r-project.org) is also a good model, though not as
good in my opinion as Matlab/Octave.
It seems to me the numerical part of rb-gsl is fantastic, but I am
often faced with assembling and dissassembling large (100 x 1000)
matrices, usually composed of lots of submatrices, and rb-gsl makes
that a little hard compared to other more mathematically oriented
languages. The problem with Octave and R though, is that they are quite
limited for general programming, while Ruby is amazing. So if you want
do some big numerical work and put it online, you are stuck.
As for recoding rb-gsl in a new framework, it might be worth waiting
until Ruby 2 is out? I wonder.
I am compiling Octave right now, and I will send you some examples of
what I am interested in being able to do after I have it working.