mdarray 0.4.2-java → 0.4.3-java

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -19,4 +19,25 @@ second dimension has a length of 3.
19
19
  [[ 1., 0., 0.],
20
20
  [ 0., 1., 2.]]
21
21
 
22
+
23
+ * MDArray Properties
24
+ + Easy calculation for large numerical multi dimensional arrays;
25
+ + Basic types are: boolean, byte, short, int, long, float, double, string, structure;
26
+ + Based on JRuby, which allows importing Java libraries. Version 0.4.0 only imports Java-NetCDF;
27
+ + Operator: +,-,*,/,%,**, >, >=, etc.
28
+ + Functions: abs, ceil, floor, truncate, is_zero, square, cube, fourth;
29
+ + Binary Operators: &, |, ^, ~ (binary_ones_complement), <<, >>;
30
+ + Ruby Math functions: acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, cos, erf, exp, gamma,
31
+ hypot, ldexp, log, log10, log2, sin, sinh, sqrt, tan, tanh, neg;
32
+ + Boolean operations on boolean arrays: and, or, not;
33
+ + Simple statistics: sum, min, max, mean, weighted_mean;
34
+ + Easy manipulation of arrays: reshape, reduce dimension, permute, section, slice, etc.
35
+
36
+
22
37
  MDArray wiki can be found at: https://github.com/rbotafogo/mdarray/wiki
38
+
39
+ HISTORY
40
+ =======
41
+
42
+ 19/04/2013: Version 0.4.3: Fixes a simple (but fatal bug). No new features
43
+ 17/04/2013: Version 0.4.2: Adds simple statistics and boolean operators
data/lib/env.rb CHANGED
@@ -1,11 +1,7 @@
1
- # Add path to CLASSPATH
1
+ require 'java'
2
2
 
3
- def add_path(path)
4
-
5
- $CLASSPATH << `cygpath -p -m #{path}`.tr("\n", "")
3
+ $CLASSPATH << "#{File.dirname(__FILE__)}/../vendor/"
6
4
 
5
+ Dir["#{File.dirname(__FILE__)}/../vendor/*.jar"].each do |jar|
6
+ require jar
7
7
  end
8
-
9
- add_path("../vendor/netcdfAll-4.3.16.jar")
10
- add_path(":../vendor/parallelcolt-0.9.4.jar")
11
- add_path(":../target/mdarray_helper.jar")
data/test/test_boolean.rb CHANGED
@@ -4,8 +4,6 @@ require 'shoulda'
4
4
 
5
5
  require 'mdarray'
6
6
 
7
- require_relative 'env'
8
-
9
7
  class MDArrayTest < Test::Unit::TestCase
10
8
 
11
9
  context "Arithmetic Tests" do
@@ -21,12 +21,10 @@
21
21
 
22
22
  require 'simplecov'
23
23
 
24
- #require_relative 'env'
25
-
26
24
  #=begin
27
25
  SimpleCov.start do
28
26
  @filters = []
29
- add_group "MDArray", "F:/rbotafogo/cygwin/home/zxb3/Desenv/MDArray/lib"
27
+ add_group "MDArray", "mdarray-0.4.2-java/lib"
30
28
  end
31
29
  #=end
32
30
 
@@ -2,7 +2,6 @@ require 'rubygems'
2
2
  require "test/unit"
3
3
  require 'shoulda'
4
4
 
5
- require 'env'
6
5
  require 'mdarray'
7
6
 
8
7
  class MDArrayTest < Test::Unit::TestCase
data/test/test_speed.rb CHANGED
@@ -3,7 +3,6 @@ require "test/unit"
3
3
  require 'shoulda'
4
4
  require 'jruby/profiler'
5
5
 
6
- require 'env'
7
6
  require 'benchmark'
8
7
 
9
8
  require 'mdarray'
data/version.rb CHANGED
@@ -1,2 +1,2 @@
1
1
  $gem_name = "mdarray"
2
- $version="0.4.2"
2
+ $version="0.4.3"
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: mdarray
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.2
5
+ version: 0.4.3
6
6
  platform: java
7
7
  authors:
8
8
  - Rodrigo Botafogo
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-17 00:00:00.000000000 Z
12
+ date: 2013-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: map
@@ -105,7 +105,6 @@ files:
105
105
  - lib/mdarray/ruby_stats.rb
106
106
  - lib/mdarray/views.rb
107
107
  - test/arithmetic_casting.rb
108
- - test/env.rb
109
108
  - test/test_access.rb
110
109
  - test/test_boolean.rb
111
110
  - test/test_comparison.rb
@@ -113,7 +112,6 @@ files:
113
112
  - test/test_counter.rb
114
113
  - test/test_creation.rb
115
114
  - test/test_error.rb
116
- - test/test_lazy.rb
117
115
  - test/test_operator.rb
118
116
  - test/test_printing.rb
119
117
  - test/test_shape.rb
@@ -153,7 +151,6 @@ specification_version: 3
153
151
  summary: Multi dimensional array similar to narray and numpy.
154
152
  test_files:
155
153
  - test/arithmetic_casting.rb
156
- - test/env.rb
157
154
  - test/test_access.rb
158
155
  - test/test_boolean.rb
159
156
  - test/test_comparison.rb
@@ -161,7 +158,6 @@ test_files:
161
158
  - test/test_counter.rb
162
159
  - test/test_creation.rb
163
160
  - test/test_error.rb
164
- - test/test_lazy.rb
165
161
  - test/test_operator.rb
166
162
  - test/test_printing.rb
167
163
  - test/test_shape.rb
data/test/env.rb DELETED
@@ -1,50 +0,0 @@
1
- require 'rbconfig'
2
-
3
- # Config::CONFIG['host_os'] # returns mswin32 on Windows, for example
4
- # p Config::CONFIG
5
-
6
- # Fix environment variable for MultiCell
7
- # Prepare environment to work inside Cygwin
8
-
9
- # Return the cygpath of a path
10
- def cygpath(path)
11
- `cygpath -p -m #{path}`.tr("\n", "")
12
- end
13
-
14
- # Add path to load path
15
- def mklib(path, home_path = true)
16
-
17
- if (home_path)
18
- lib = path + "/lib"
19
- else
20
- lib = path
21
- end
22
-
23
- $LOAD_PATH << `cygpath -p -m #{lib}`.tr("\n", "")
24
-
25
- end
26
-
27
- # Home directory for MDArray
28
- $MDARRAY_HOME_DIR = "/home/zxb3/Desenv/MDArray"
29
- mklib($MDARRAY_HOME_DIR)
30
-
31
- # Home directory for MultiCell
32
- $MC_HOME_DIR = "/home/zxb3/Desenv/MultiCell"
33
- mklib($MC_HOME_DIR)
34
-
35
- # Home directory for NcInterface
36
- $NCI_HOME_DIR = "/home/zxb3/Desenv/NcInterface"
37
- mklib($NCI_HOME_DIR)
38
-
39
- # Home directory for BM&F Bovespa files
40
- $BMF_BOVESPA_DIR = "/home/zxb3/Investimentos/SeriesHistoricas/BMF_BOVESPA/"
41
-
42
- # Home directory for results
43
- $RESULT_HOME_DIR = $MC_HOME_DIR + "/results/"
44
-
45
- =begin
46
- # Build Jruby classpath from environment classpath
47
- ENV['WCLASSPATH'].split(';').each do |path|
48
- $CLASSPATH << cygpath(path)
49
- end
50
- =end
data/test/test_lazy.rb DELETED
@@ -1,52 +0,0 @@
1
- require 'rubygems'
2
- require "test/unit"
3
- require 'shoulda'
4
-
5
- require 'env'
6
- require 'mdarray'
7
-
8
- class MDArrayTest < Test::Unit::TestCase
9
-
10
- context "Arithmetic Tests" do
11
-
12
- setup do
13
-
14
- # create a = [20 30 40 50]
15
- @a = MDArray.arange(20, 60, 10)
16
- # create b = [0 1 2 3]
17
- @b = MDArray.arange(4)
18
- # create c = [1.87 5.34 7.18 8.84]
19
- @c = MDArray.double([4], [1.87, 5.34, 7.18, 8.84])
20
- # create d = [[1 2] [3 4]]
21
- @d = MDArray.int([2, 2], [1, 2, 3, 4])
22
- # creates an array from a function (actually a block). The name fromfunction
23
- # is preserved to maintain API compatibility with NumPy (is it necessary?)
24
- @e = MDArray.fromfunction("double", [4, 5, 6]) do |x, y, z|
25
- 3.21 * (x + y + z)
26
- end
27
- @f = MDArray.fromfunction("double", [4, 5, 6]) do |x, y, z|
28
- 9.57 * x + y + z
29
- end
30
- @g = MDArray.byte([1], [60])
31
- @h = MDArray.byte([1], [13])
32
- @i = MDArray.double([4], [2.0, 6.0, 5.0, 9.0])
33
-
34
- end # setup
35
-
36
- #-------------------------------------------------------------------------------------
37
- #
38
- #-------------------------------------------------------------------------------------
39
-
40
- should "do basic lazy operations" do
41
-
42
- op = @a.add_(@b)
43
- p op
44
- p op.type
45
- op.exec(3)
46
-
47
- end
48
-
49
- end
50
-
51
- end
52
-