In article [email protected],
[email protected] wrote:
- Matlab language syntax maps closely to the underlying concepts (i.e.
- It’s easy to write C (or FORTRAN) extensions when you really need
- You’d need to write or find plotting/visualisation library for Ruby.
I’ve not looked, but I’d hope this is reasonably trivial.
There are a few things out there. There’s a gnuplot interface, for
example.
- You’d need to find or write a library to let you do efficient matrix
computations. I know there is stuff for Ruby out there, but it won’t be
as well-tested as Matlab’s and it’s not a first class citizen of the
environment. Writing your own is much harder than it seems. You really
need a library that allows you to call LAPACK routines from Ruby.
Seems to me that narray has most of what you need here.
- Ruby has the irb REPL. This is fine.
- Ruby seems to be pretty cross-platform, but you’d need to check the
same is true for the additional libraries you’d need. You might not
care about WIndows, but what about your colleagues? You often need to
share code with them.
No, they’ve all bought iBooks or PowerBooks by now
- No compiling, but also no JIT as far as I’m aware. Not too big an
issue if you’ve got a good matrix library.
narray is implemented in C.
- I’ve not tried profiling in Ruby, but Matlab’s profiler is very
good. If you can’t profile your code and you’re doing numerics, you’re
in trouble.
Ruby has reasonably good profiling ability.
- I understand you can write Ruby extensions in C but I’ve not done
it.
It’s quite easy. It’s even easier if you use Ruby::Inline.
Here’s an tantalizing idea that I’ll throw out: C is one thing and,
yes, it’s
fast… but what if you could actually map some algorithm or math
operation to
hardware and thus get a large speed advantage even over C? I’m
working on
something like this… details forthcoming. The idea is very similar to
Ruby::Inline. It will allow seamless communication between your Ruby
program
and an FPGA board acting as hardware accelerator (these boards are
available
for less than $200 now).
- The ecosystem for your problem domain is going to be much smaller in
Ruby than in Matlab. Ruby’s best ecosystem domain seems to be webapps
(i.e. Rails).
Maybe that’s the most successful domain related to Ruby up to this
point,
however there are people using Ruby for scientific apps - see the
SciRuby site:
http://sciruby.codeforpeople.com/
Ruby isn’t just for webapps. In fact, until the last 18 months or so,
people
were wondering if Ruby would be a player in the webapp space - how
quickly
things change, eh?
reasons why you don’t want to use it (it’s not open source, for
example), you should probably use and improve Octave, the open source
equivalent to Matlab. However, if you need to roll your own soluation,
I think Ruby would make a very good foundation for putting together
your own environment for numerical computing.
Yes, and part of the philosophical argument as I see it is that tools
like
MatLab are becoming ‘required’ for doing research (many people think so
anyway), kind of like using LaTeX for writing papers. However, LaTeX is
free.
It would be great to have a completely free tool for research since
computational methods are becoming central to so much research.
I think the real question is whether you want to do the ‘fun’ thing and
start (almost) from scratch (i.e. base your environment on Ruby) or
stand on the shoulders of giants (i.e. use Matlab or Octave). If you’ve
got real problems to solve now, you should probably resist the
temptation to do the fun thing.
However, I think you’d be surprised at how much is already available in
Ruby.
Check it out and see if what you need might already be there (or be
almost
there). Also, get on SciRuby and post requests.
Phil