boost_distributions is a Ruby gem to calculate various properties of statistical distributions supported by boost::math::distributions.
Before gem install
, boost headers are required. For well-known platforms, try appropriate one of the followings:
(Assumption: Most of users may use Ruby installer.) Please check whether your Ruby has been installed with devkit. If not, please re-install Ruby with devkit, which is found at the top of the page. Then, run Start Command Prompt with Ruby
from the start menu to launch the command line interface, and type following commands (each line requires hitting enter after inputs, and hit Y key when you are asked something like "install OK?"):
ridk enable
pacman -Syy
pacman -S mingw-w64-ucrt-x86_64-boost
By using setup-x86_64.exe
Cygwin GUI installer, select libboost-devel unless the headers have been installed.
$ apt-get install libboost-dev
After installation of boost headers, install the gem as:
$ gem install boost_distributions
Note that if your boost headers are not in the standard path, the following alternative is helpful for each method.
$ gem install boost_distributions -- --with-boost-include=/path/to/parent_directory_of_boost_header
Or if you want to include it into your application, add this line to Gemfile:
gem 'boost_distributions'
and execute:
$ bundle install
following
$ bundle config build.boost_distributions --with-boost-include=/path/to/parent_directory_of_boost_header
if your boost headers are in the non-standared path.
Example usage is as the followings:
require 'boost_distributions'
# Generate normal (Gaussian) distribution instance with mu = 0, sigma = 1
normal = BoostDistributions::Normal::new(0, 1)
normal.mean # => 0
normal.standard_deviation # => 1.0
normal.pdf(0) # => 0.399, Probability density function
normal.cdf(0) # => 0.5, Cumulative distribution function
normal.quantile(0.5) # => 0
List of supported distributions are:
See documentation in rubyrdoc.info
After checking out the repo, run bundle install
to install dependencies. To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
There are some useful commands in developement life-cycle.
Command | Description |
---|---|
bundle exec rake swig |
Re-generate wrapper C code |
bundle exec rake compile |
compile shared library |
bundle exec rake spec |
run tests |
Bug reports and pull requests are welcome on GitHub at https://github.com/fenrir-naru/ruby-boost_distributions. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Everyone interacting in the BoostDistributions project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.