EzDevInfo.com

sciruby

Tools for scientific computation in Ruby SciRuby the sciruby manifesto ruby has for some time lacked libraries implementing the basic tools needed for scientific computing and data visualization. …

Is there a scientific library for generating probability distributions in JavaScript?

Is there a scientific library in JavaScript that can generate probability distributions like this library in Ruby?

http://rb-gsl.rubyforge.org/

For more details on the use cases see this related question: Generate Array of Numbers that fit to a Probability Distribution in Ruby?


Source: (StackOverflow)

Generate Array of Numbers that fit to a Probability Distribution in Ruby?

Say I have 100 records, and I want to mock out the created_at date so it fits on some curve. Is there a library to do that, or what formula could I use? I think this is along the same track:

Generate Random Numbers with Probabilistic Distribution

I don't know much about how they are classified in mathematics, but I'm looking at things like:

  • bell curve
  • logarithmic (typical biology/evolution) curve? ...

Just looking for some formulas in code so I can say this:

  • Given 100 records, a timespan of 1.week, and an interval of 12.hours
  • set created_at for each record such that it fits, roughly, to curve

Thanks so much!

Update

I found this forum post about ruby algorithms, which led me to rsruby, an R/Ruby bridge, but that seems like too much.

Update 2

I wrote this little snippet trying out the gsl library, getting there...

Generate test data in Rails where created_at falls along a Statistical Distribution


Source: (StackOverflow)

Advertisements

Error installing SciRuby at have_package call for atk

Best I can tell, a gem (atk) is being installed, thinks it is succeeding, but then is not accessible. After digging through these log messages, I'm stuck without knowing where to look next. Does anyone have nay pointers to where I could look to see what the actual error it and how to fix it?

The same error occurs using bundle install from the project directory, gem install sciruby, or just gem install atk.

From the top level output:

installing 'atk' native package... succeeded
checking for atk version (>= 1.12.0)... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

What I think is the relevant part of the log is this tail of .rvm/gems/ruby-1.9.3-p448/gems/atk-2.2.5/ext/atk/mkmf.log:

--->  Computing dependencies for atk
For atk: skipping org.macports.main (dry run)
--->  Scanning binaries for linking errors
--->  No broken files found.
installing 'atk' native package... succeeded
--------------------

have_package: checking for atk version (>= 1.12.0)... -------------------- no

--------------------

Any ideas?


Source: (StackOverflow)

Undefined symbol clapack_cgetrf trying to load NMatrix

I've installed NMatrix via gem on a machine with Ubuntu 15.04, according to the instructions found here: https://github.com/SciRuby/nmatrix/wiki/Installation

However, when trying to import the library with require 'nmatrix', i get the following error:

LoadError: /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nmatrix-0.1.0/nmatrix.so: undefined symbol: clapack_cgetrf - /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nmatrix-0.1.0/nmatrix.so
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'

Seems like the undefined symbol has to do with the ATLAS library, but I really don't know how I should address the problem. Does anybody have any suggestion?


Source: (StackOverflow)

Install SciRuby failed on OS X

I have gcc6.1 installed on OS X via brew, when I tried to install sciruby-full on my Mac, always got this Error:

>Fetching: nmatrix-0.1.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing sciruby-full:
    ERROR: Failed to build gem native extension.

    /usr/local/opt/ruby/bin/ruby -r ./siteconf20150627-98945-1pk3go6.rb extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... Exception `RuntimeError' at extconf.rb:144 - You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/Cellar/ruby/2.2.2/bin/$(RUBY_BASE_NAME)
extconf.rb:144:in `<main>': You need a version of g++ which supports -std=c++0x or -std=c++11. If you're on a Mac and using Homebrew, we recommend using mac-brew-gcc.sh to install a more recent g++. (RuntimeError)

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/nmatrix-0.1.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nmatrix-0.1.0/gem_make.out

My ruby and OS X is always the newest: Ruby 2.2.2 on updated Yosemite.


Source: (StackOverflow)

where do i find documentation and examples of the sciruby nmatrix C/C++ api?

I am trying to write ruby interfaces to a piece scientific computation library I wrote. This library itself uses other open-source libraries like OpenCV, boost etc. The primary data structure my library operates on, and that is being returned by my library, is an n-dimensional array type. Hence I was looking into which appropriate ruby objects this data type will map into. There is the native ruby array type, but I also found out the more mathematically powerful Nmatrix type. Can someone point me to the documentation for the C/C++ api for nmatrix? Googling around for the C api docs did not help. I found some docs here http://sciruby.com/nmatrix/docs/ and the code repos on github here https://github.com/SciRuby/nmatrix and so far have been using the source code as the docs. A few examples would be nice too.


Source: (StackOverflow)