Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sparse Matrix Libraries for Ruby

I'm looking for a Sparse Matrix library I can use from Ruby. I'm currently using the GNU Scientific Library bindings provided by the "gsl" gem, but my application would be better optimized if I used a dedicated sparse matrix library. I've investigated the linalg and NArray libraries. None of the these three libraries support sparse-matrix optimised storage or operations.

Is there anything out there I've missed - or an existing C library that may be possible to write bindings for? I'd prefer the former to that latter, as I haven't written C bindings in Ruby before, but I would be willing to attempt it.

like image 916
Chris Lowis Avatar asked Jul 18 '11 07:07

Chris Lowis


People also ask

What is nmatrix in Ruby?

NMatrix is a fast numerical linear algebra library for Ruby, with dense and sparse matrices, written mostly in C and C++ (and with experimental JRuby support). It is part of the SciRuby project. NMatrix was inspired by NArray, by Masahiro Tanaka.

Is Ruby good for Scientific Computing and data visualization?

Ruby is a great choice for scientific computing and data visualization. Even though other languages have more libraries - and we can not do without them - Ruby has its own place in Science and it is always a pleasure to write software in Ruby.

Does Ruby have a place in science?

Even though other languages have more libraries - and we can not do without them - Ruby has its own place in Science and it is always a pleasure to write software in Ruby. But there is only one way to find out and that is by writing code!

Is there an open source license for RubyMine?

JetBrains has kindly provided our project with an open source license for RubyMine . The Ruby Association generously awarded us with a rather large grant to fund a couple of SciRuby fellows in 2012. Thanks, Ruby Association!


1 Answers

Like Bill mentioned above, the a pure ruby interpretation is going to be slower than you want, but might be good for prototyping. I have been working on just such a library over at https://github.com/hmcfletch/sparse-matrix

I haven't released it as a gem yet and there is more work to be done on it, but take a look at if you stil have a need.

like image 159
HMCFletch Avatar answered Sep 18 '22 15:09

HMCFletch