rcommonsmath 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +3 -0
- data/.rspec +1 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +4 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +20 -0
- data/README.md +38 -0
- data/Rakefile +33 -0
- data/examples/random_gaussians.rb +10 -0
- data/gemspec.yml +11 -0
- data/lib/rcommonsmath.rb +23 -0
- data/lib/rcommonsmath/version.rb +4 -0
- data/rcommonsmath.gemspec +15 -0
- data/spec/rcommonsmath_spec.rb +8 -0
- data/spec/spec_helper.rb +4 -0
- metadata +94 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour --format documentation
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --title "rcommonsmath Documentation" --protected
|
data/ChangeLog.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Patrik Sundberg
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# rcommonsmath
|
2
|
+
|
3
|
+
* [Homepage](https://github.com/sundbp/rcommonsmath)
|
4
|
+
* [Documentation](http://rubydoc.info/gems/rcommonsmath/frames)
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
A simple jruby wrapper around the java library [commons-math](http://commons.apache.org/math/).
|
9
|
+
All it does is provide a structured way to require the jar files. The user refers to the java
|
10
|
+
classes as usual (i.e. org.apache.commons.math.random.RandomGenerator).
|
11
|
+
|
12
|
+
Potentially some utilities to enhance productivity and make it more ruby friendly will be added
|
13
|
+
later as well.
|
14
|
+
|
15
|
+
## Examples
|
16
|
+
|
17
|
+
TODO: fill this in
|
18
|
+
|
19
|
+
require 'rcommonsmath'
|
20
|
+
|
21
|
+
## Requirements
|
22
|
+
|
23
|
+
* commons-math jar
|
24
|
+
* setting the environment variable **RCOMMONSMATH_JAR_PATH** as described below
|
25
|
+
|
26
|
+
## Install
|
27
|
+
|
28
|
+
$ gem install rcommonsmath
|
29
|
+
|
30
|
+
Download and unpack [commons-math](http://commons.apache.org/math/download_math.cgi),
|
31
|
+
and set the environment variable **RCOMMONSMATH_JAR_PATH** to the path containg the
|
32
|
+
commons-math jar.
|
33
|
+
|
34
|
+
## Copyright
|
35
|
+
|
36
|
+
Copyright (c) 2011 Patrik Sundberg
|
37
|
+
|
38
|
+
See {file:LICENSE.txt} for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'bundler'
|
5
|
+
rescue LoadError => e
|
6
|
+
STDERR.puts e.message
|
7
|
+
STDERR.puts "Run `gem install bundler` to install Bundler."
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
begin
|
12
|
+
Bundler.setup(:development)
|
13
|
+
rescue Bundler::BundlerError => e
|
14
|
+
STDERR.puts e.message
|
15
|
+
STDERR.puts "Run `bundle install` to install missing gems."
|
16
|
+
exit e.status_code
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'rake'
|
20
|
+
|
21
|
+
require 'ore/tasks'
|
22
|
+
Ore::Tasks.new
|
23
|
+
|
24
|
+
require 'rspec/core/rake_task'
|
25
|
+
RSpec::Core::RakeTask.new
|
26
|
+
|
27
|
+
task :test => :spec
|
28
|
+
task :default => :spec
|
29
|
+
|
30
|
+
|
31
|
+
require 'yard'
|
32
|
+
YARD::Rake::YardocTask.new
|
33
|
+
task :doc => :yard
|
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
2
|
+
require 'rcommonsmath'
|
3
|
+
|
4
|
+
java_import "org.apache.commons.math.random.MersenneTwister"
|
5
|
+
|
6
|
+
generator = MersenneTwister.new(Time.now.to_i)
|
7
|
+
|
8
|
+
random_gaussians = Array.new(10).map {|x| generator.nextGaussian }
|
9
|
+
|
10
|
+
p random_gaussians
|
data/gemspec.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
name: rcommonsmath
|
2
|
+
summary: "Thin jruby wrapper for commons-math"
|
3
|
+
description: "A thin jruby wrapper for commons-math (mainly just a way to load the jars in a structured way for now)"
|
4
|
+
license: MIT
|
5
|
+
authors: Patrik Sundberg
|
6
|
+
homepage: http://rubygems.org/gems/rcommonsmath
|
7
|
+
has_yard: true
|
8
|
+
|
9
|
+
development_dependencies:
|
10
|
+
bundler: ~> 1.0.0
|
11
|
+
yard: ~> 0.6.0
|
data/lib/rcommonsmath.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rcommonsmath/version'
|
2
|
+
|
3
|
+
require 'java'
|
4
|
+
|
5
|
+
module Rcommonsmath
|
6
|
+
|
7
|
+
def self.jars
|
8
|
+
[
|
9
|
+
'commons-math-2.2'
|
10
|
+
]
|
11
|
+
end
|
12
|
+
|
13
|
+
Rcommonsmath.jars.each do |jar|
|
14
|
+
raise "You must set RCOMMONSMATH_JAR_PATH!" if ENV['RCOMMONSMATH_JAR_PATH'].nil?
|
15
|
+
begin
|
16
|
+
require File.join(ENV['RCOMMONSMATH_JAR_PATH'], jar)
|
17
|
+
rescue LoadError => e
|
18
|
+
STDERR.puts e.message
|
19
|
+
STDERR.puts "Make sure you have set RCOMMONSMATH_JAR_PATH to the path where your commons-math jars are stored."
|
20
|
+
exit -1
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
begin
|
4
|
+
Ore::Specification.new do |gemspec|
|
5
|
+
# custom logic here
|
6
|
+
end
|
7
|
+
rescue NameError
|
8
|
+
begin
|
9
|
+
require 'ore/specification'
|
10
|
+
retry
|
11
|
+
rescue LoadError
|
12
|
+
STDERR.puts "The '#{__FILE__}' file requires Ore."
|
13
|
+
STDERR.puts "Run `gem install ore-core` to install Ore."
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rcommonsmath
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Patrik Sundberg
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-05 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: bundler
|
18
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.0
|
24
|
+
requirement: *id001
|
25
|
+
prerelease: false
|
26
|
+
type: :development
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yard
|
29
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.6.0
|
35
|
+
requirement: *id002
|
36
|
+
prerelease: false
|
37
|
+
type: :development
|
38
|
+
description: A thin jruby wrapper for commons-math (mainly just a way to load the jars in a structured way for now)
|
39
|
+
email: []
|
40
|
+
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files:
|
46
|
+
- README.md
|
47
|
+
- ChangeLog.md
|
48
|
+
- LICENSE.txt
|
49
|
+
files:
|
50
|
+
- .document
|
51
|
+
- .rspec
|
52
|
+
- .yardopts
|
53
|
+
- ChangeLog.md
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- examples/random_gaussians.rb
|
59
|
+
- gemspec.yml
|
60
|
+
- lib/rcommonsmath.rb
|
61
|
+
- lib/rcommonsmath/version.rb
|
62
|
+
- rcommonsmath.gemspec
|
63
|
+
- spec/rcommonsmath_spec.rb
|
64
|
+
- spec/spec_helper.rb
|
65
|
+
has_rdoc: yard
|
66
|
+
homepage: http://rubygems.org/gems/rcommonsmath
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.3.6
|
86
|
+
requirements: []
|
87
|
+
|
88
|
+
rubyforge_project: rcommonsmath
|
89
|
+
rubygems_version: 1.6.2
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Thin jruby wrapper for commons-math
|
93
|
+
test_files:
|
94
|
+
- spec/rcommonsmath_spec.rb
|