mdarray 0.4.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +54 -0
- data/LICENSE.txt~ +32 -0
- data/README.md +21 -0
- data/Rakefile +40 -0
- data/lib/env.rb +11 -0
- data/lib/mdarray.rb +414 -0
- data/lib/mdarray/access.rb +237 -0
- data/lib/mdarray/counter.rb +779 -0
- data/lib/mdarray/creation.rb +413 -0
- data/lib/mdarray/fast_non_numerical.rb +102 -0
- data/lib/mdarray/function_creation.rb +100 -0
- data/lib/mdarray/function_map.rb +56 -0
- data/lib/mdarray/hierarchy.rb +177 -0
- data/lib/mdarray/operators.rb +220 -0
- data/lib/mdarray/printing.rb +275 -0
- data/lib/mdarray/proc_util.rb +159 -0
- data/lib/mdarray/ruby_functions.rb +78 -0
- data/lib/mdarray/ruby_generic_functions.rb +37 -0
- data/lib/mdarray/ruby_math.rb +57 -0
- data/lib/mdarray/ruby_numeric_functions.rb +187 -0
- data/lib/mdarray/ruby_operators.rb +201 -0
- data/lib/mdarray/ruby_stats.rb +149 -0
- data/lib/mdarray/slices.rb +185 -0
- data/lib/mdarray/statistics.rb +86 -0
- data/test/arithmetic_casting.rb +195 -0
- data/test/env.rb +50 -0
- data/test/test_access.rb +247 -0
- data/test/test_boolean.rb +67 -0
- data/test/test_comparison.rb +126 -0
- data/test/test_complete.rb +69 -0
- data/test/test_counter.rb +184 -0
- data/test/test_creation.rb +364 -0
- data/test/test_error.rb +53 -0
- data/test/test_lazy.rb +52 -0
- data/test/test_operator.rb +337 -0
- data/test/test_printing.rb +66 -0
- data/test/test_shape.rb +96 -0
- data/test/test_slices.rb +146 -0
- data/test/test_speed.rb +311 -0
- data/test/test_statistics.rb +45 -0
- data/test/test_trigonometry.rb +60 -0
- data/vendor/netcdfAll-4.3.16.jar +0 -0
- data/version.rb +2 -0
- metadata +197 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "test/unit"
|
3
|
+
require 'shoulda'
|
4
|
+
|
5
|
+
require 'env'
|
6
|
+
require 'mdarray'
|
7
|
+
require 'benchmark'
|
8
|
+
|
9
|
+
class MDArrayTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
context "Statistics Tests" do
|
12
|
+
|
13
|
+
setup do
|
14
|
+
|
15
|
+
# create a byte array filled with 0's
|
16
|
+
@a = MDArray.typed_arange("double", 10_000)
|
17
|
+
@weight = MDArray.arange(10_000)
|
18
|
+
|
19
|
+
# create double array
|
20
|
+
@b = MDArray.double([2, 3, 4])
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
#-------------------------------------------------------------------------------------
|
25
|
+
#
|
26
|
+
#-------------------------------------------------------------------------------------
|
27
|
+
|
28
|
+
should "do stats operations" do
|
29
|
+
|
30
|
+
# @a.unary_operator = FastUnaryOperator
|
31
|
+
assert_equal(49995000, @a.sum)
|
32
|
+
assert_equal(0, @a.min)
|
33
|
+
assert_equal(9999, @a.max)
|
34
|
+
assert_equal(4999.5, @a.mean)
|
35
|
+
|
36
|
+
# @a.binary_operator = BinaryOperator
|
37
|
+
puts Benchmark.measure {
|
38
|
+
assert_equal(6666.333333333333, @a.weighted_mean(@weight)[0])
|
39
|
+
}
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
##########################################################################################
|
4
|
+
# Copyright © 2013 Rodrigo Botafogo. All Rights Reserved. Permission to use, copy, modify,
|
5
|
+
# and distribute this software and its documentation, without fee and without a signed
|
6
|
+
# licensing agreement, is hereby granted, provided that the above copyright notice, this
|
7
|
+
# paragraph and the following two paragraphs appear in all copies, modifications, and
|
8
|
+
# distributions.
|
9
|
+
#
|
10
|
+
# IN NO EVENT SHALL RODRIGO BOTAFOGO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
11
|
+
# INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
12
|
+
# THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RODRIGO BOTAFOGO HAS BEEN ADVISED OF THE
|
13
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
14
|
+
#
|
15
|
+
# RODRIGO BOTAFOGO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
16
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
|
17
|
+
# SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
|
18
|
+
# RODRIGO BOTAFOGO HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
|
19
|
+
# OR MODIFICATIONS.
|
20
|
+
##########################################################################################
|
21
|
+
|
22
|
+
require 'rubygems'
|
23
|
+
require "test/unit"
|
24
|
+
require 'shoulda'
|
25
|
+
|
26
|
+
require 'mdarray'
|
27
|
+
|
28
|
+
class MDArrayTest < Test::Unit::TestCase
|
29
|
+
|
30
|
+
context "Trigonometric Tests" do
|
31
|
+
|
32
|
+
setup do
|
33
|
+
|
34
|
+
# create a byte array filled with 0's
|
35
|
+
@a = MDArray.typed_arange("double", 90)
|
36
|
+
|
37
|
+
# create double array
|
38
|
+
@b = MDArray.double([2, 3, 4])
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
#-------------------------------------------------------------------------------------
|
43
|
+
#
|
44
|
+
#-------------------------------------------------------------------------------------
|
45
|
+
|
46
|
+
should "execute trigonometric functions" do
|
47
|
+
|
48
|
+
sin = @a.sin
|
49
|
+
cos = @a.cos
|
50
|
+
|
51
|
+
id = sin**2 + cos**2
|
52
|
+
assert_equal(1, id)
|
53
|
+
|
54
|
+
sec = 1 / @a.cos
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
Binary file
|
data/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mdarray
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.4.0
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- Rodrigo Botafogo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: !binary |-
|
21
|
+
MA==
|
22
|
+
none: false
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: !binary |-
|
28
|
+
MA==
|
29
|
+
none: false
|
30
|
+
prerelease: false
|
31
|
+
type: :runtime
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: rspec
|
34
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 2.0.0
|
39
|
+
none: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.0.0
|
45
|
+
none: false
|
46
|
+
prerelease: false
|
47
|
+
type: :development
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: simplecov
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: !binary |-
|
55
|
+
MA==
|
56
|
+
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: !binary |-
|
62
|
+
MA==
|
63
|
+
none: false
|
64
|
+
prerelease: false
|
65
|
+
type: :development
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: yard
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: !binary |-
|
73
|
+
MA==
|
74
|
+
none: false
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: !binary |-
|
80
|
+
MA==
|
81
|
+
none: false
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: kramdown
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: !binary |-
|
91
|
+
MA==
|
92
|
+
none: false
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: !binary |-
|
98
|
+
MA==
|
99
|
+
none: false
|
100
|
+
prerelease: false
|
101
|
+
type: :development
|
102
|
+
description: "\"Multi dimensional array similar to Masahiro Tanaka's narray and numpy.\
|
103
|
+
\ \nIt is specifically targeted to JRuby as it uses Java-NetCDF library as base\
|
104
|
+
\ Array.\"\n"
|
105
|
+
email: rodrigo.a.botafogo@gmail.com
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- Rakefile
|
111
|
+
- version.rb
|
112
|
+
- lib/env.rb
|
113
|
+
- lib/mdarray.rb
|
114
|
+
- lib/mdarray/access.rb
|
115
|
+
- lib/mdarray/counter.rb
|
116
|
+
- lib/mdarray/creation.rb
|
117
|
+
- lib/mdarray/fast_non_numerical.rb
|
118
|
+
- lib/mdarray/function_creation.rb
|
119
|
+
- lib/mdarray/function_map.rb
|
120
|
+
- lib/mdarray/hierarchy.rb
|
121
|
+
- lib/mdarray/operators.rb
|
122
|
+
- lib/mdarray/printing.rb
|
123
|
+
- lib/mdarray/proc_util.rb
|
124
|
+
- lib/mdarray/ruby_functions.rb
|
125
|
+
- lib/mdarray/ruby_generic_functions.rb
|
126
|
+
- lib/mdarray/ruby_math.rb
|
127
|
+
- lib/mdarray/ruby_numeric_functions.rb
|
128
|
+
- lib/mdarray/ruby_operators.rb
|
129
|
+
- lib/mdarray/ruby_stats.rb
|
130
|
+
- lib/mdarray/slices.rb
|
131
|
+
- lib/mdarray/statistics.rb
|
132
|
+
- test/arithmetic_casting.rb
|
133
|
+
- test/env.rb
|
134
|
+
- test/test_access.rb
|
135
|
+
- test/test_boolean.rb
|
136
|
+
- test/test_comparison.rb
|
137
|
+
- test/test_complete.rb
|
138
|
+
- test/test_counter.rb
|
139
|
+
- test/test_creation.rb
|
140
|
+
- test/test_error.rb
|
141
|
+
- test/test_lazy.rb
|
142
|
+
- test/test_operator.rb
|
143
|
+
- test/test_printing.rb
|
144
|
+
- test/test_shape.rb
|
145
|
+
- test/test_slices.rb
|
146
|
+
- test/test_speed.rb
|
147
|
+
- test/test_statistics.rb
|
148
|
+
- test/test_trigonometry.rb
|
149
|
+
- vendor/netcdfAll-4.3.16.jar
|
150
|
+
- README.md
|
151
|
+
- LICENSE.txt
|
152
|
+
- LICENSE.txt~
|
153
|
+
homepage: http://github.com/rbotafogo/mdarray
|
154
|
+
licenses: []
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: !binary |-
|
164
|
+
MA==
|
165
|
+
none: false
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: !binary |-
|
171
|
+
MA==
|
172
|
+
none: false
|
173
|
+
requirements: []
|
174
|
+
rubyforge_project:
|
175
|
+
rubygems_version: 1.8.24
|
176
|
+
signing_key:
|
177
|
+
specification_version: 3
|
178
|
+
summary: Multi dimensional array similar to narray and numpy.
|
179
|
+
test_files:
|
180
|
+
- test/arithmetic_casting.rb
|
181
|
+
- test/env.rb
|
182
|
+
- test/test_access.rb
|
183
|
+
- test/test_boolean.rb
|
184
|
+
- test/test_comparison.rb
|
185
|
+
- test/test_complete.rb
|
186
|
+
- test/test_counter.rb
|
187
|
+
- test/test_creation.rb
|
188
|
+
- test/test_error.rb
|
189
|
+
- test/test_lazy.rb
|
190
|
+
- test/test_operator.rb
|
191
|
+
- test/test_printing.rb
|
192
|
+
- test/test_shape.rb
|
193
|
+
- test/test_slices.rb
|
194
|
+
- test/test_speed.rb
|
195
|
+
- test/test_statistics.rb
|
196
|
+
- test/test_trigonometry.rb
|
197
|
+
has_rdoc:
|