nmatrix 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/ext/nmatrix/data/ruby_object.h +1 -1
- data/ext/nmatrix/math.cpp +274 -33
- data/ext/nmatrix/math/math.h +8 -2
- data/ext/nmatrix/ruby_nmatrix.c +81 -65
- data/lib/nmatrix/blas.rb +6 -2
- data/lib/nmatrix/cruby/math.rb +744 -0
- data/lib/nmatrix/enumerate.rb +3 -2
- data/lib/nmatrix/jruby/decomposition.rb +24 -0
- data/lib/nmatrix/jruby/enumerable.rb +13 -0
- data/lib/nmatrix/jruby/error.rb +4 -0
- data/lib/nmatrix/jruby/math.rb +501 -0
- data/lib/nmatrix/jruby/nmatrix_java.rb +840 -0
- data/lib/nmatrix/jruby/operators.rb +283 -0
- data/lib/nmatrix/jruby/slice.rb +264 -0
- data/lib/nmatrix/math.rb +233 -635
- data/lib/nmatrix/mkmf.rb +6 -9
- data/lib/nmatrix/monkeys.rb +2 -4
- data/lib/nmatrix/nmatrix.rb +62 -32
- data/lib/nmatrix/shortcuts.rb +8 -3
- data/lib/nmatrix/version.rb +1 -1
- data/spec/00_nmatrix_spec.rb +110 -3
- data/spec/01_enum_spec.rb +7 -1
- data/spec/02_slice_spec.rb +19 -1
- data/spec/03_nmatrix_monkeys_spec.rb +2 -0
- data/spec/elementwise_spec.rb +10 -2
- data/spec/homogeneous_spec.rb +1 -0
- data/spec/io_spec.rb +11 -1
- data/spec/math_spec.rb +346 -102
- data/spec/rspec_spec.rb +1 -0
- data/spec/shortcuts_spec.rb +47 -23
- data/spec/slice_set_spec.rb +7 -2
- data/spec/stat_spec.rb +11 -0
- metadata +20 -41
- data/ext/nmatrix/ttable_helper.rb +0 -115
data/spec/rspec_spec.rb
CHANGED
@@ -28,6 +28,7 @@ require 'spec_helper'
|
|
28
28
|
|
29
29
|
describe "RSpec" do
|
30
30
|
it "should permit #be_within to be used on a dense NMatrix" do
|
31
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
31
32
|
expect(NMatrix.new([4,1], 1.0, dtype: :complex128, stype: :dense) / 10000.0).to be_within(0.00000001).of(NMatrix.new([4,1], 0.0001, dtype: :float64, stype: :dense))
|
32
33
|
expect(NMatrix.new([4,1], 1.0, dtype: :complex128, stype: :dense) / 10000.0).not_to be_within(0.00000001).of(NMatrix.new([4,1], 1.0, dtype: :float64, stype: :dense))
|
33
34
|
end
|
data/spec/shortcuts_spec.rb
CHANGED
@@ -104,13 +104,14 @@ describe NMatrix do
|
|
104
104
|
[:dense, :yale, :list].each do |stype|
|
105
105
|
context "#block_diagonal #{dtype} #{stype}" do
|
106
106
|
it "block_diagonal() creates a block-diagonal NMatrix" do
|
107
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby? and dtype == :object
|
107
108
|
a = NMatrix.new([2,2], [1,2,
|
108
109
|
3,4])
|
109
110
|
b = NMatrix.new([1,1], [123.0])
|
110
111
|
c = NMatrix.new([3,3], [1,2,3,
|
111
112
|
1,2,3,
|
112
113
|
1,2,3])
|
113
|
-
d = Array[ [1,1,1], [2,2,2], [3,3,3] ]
|
114
|
+
d = Array[ [1,1,1], [2,2,2], [3,3,3] ]
|
114
115
|
e = 12
|
115
116
|
m = NMatrix.block_diagonal(a, b, c, d, e, dtype: dtype, stype: stype)
|
116
117
|
expect(m).to eq(NMatrix.new([10,10], [1, 2, 0, 0, 0, 0, 0, 0, 0, 0,
|
@@ -136,6 +137,17 @@ describe NMatrix do
|
|
136
137
|
expect(m.dtype).to eq(:float64)
|
137
138
|
end
|
138
139
|
|
140
|
+
it "creates a matrix of random numbers with defined seed value" do
|
141
|
+
m1 = NMatrix.random(2,:seed => 62)
|
142
|
+
m2 = NMatrix.random(2,:seed => 62)
|
143
|
+
m3 = NMatrix.random(2,:seed => 65)
|
144
|
+
|
145
|
+
|
146
|
+
expect(m1).to eq(m2)
|
147
|
+
expect(m1).not_to eq(m3)
|
148
|
+
|
149
|
+
end
|
150
|
+
|
139
151
|
it "creates a complex matrix of random numbers" do
|
140
152
|
m = NMatrix.random(2, :dtype => :complex128)
|
141
153
|
end
|
@@ -158,42 +170,44 @@ describe NMatrix do
|
|
158
170
|
expect { NMatrix.random("not an array or integer") }.to raise_error
|
159
171
|
end
|
160
172
|
end
|
161
|
-
|
173
|
+
|
162
174
|
context "::magic" do
|
163
|
-
|
175
|
+
|
164
176
|
ALL_DTYPES.each do |dtype|
|
165
177
|
context dtype do
|
166
178
|
it "creates a matrix with numbers from 1 to n^n(n squared)" do
|
179
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
167
180
|
a = NMatrix.magic(3, dtype: dtype)
|
168
|
-
magic3 = NMatrix.new([3,3], [4, 9, 2, 3, 5, 7, 8, 1, 6], dtype: dtype)
|
181
|
+
magic3 = NMatrix.new([3,3], [4, 9, 2, 3, 5, 7, 8, 1, 6], dtype: dtype)
|
169
182
|
expect(a).to eq magic3
|
170
|
-
|
183
|
+
|
171
184
|
b = NMatrix.magic(4, dtype: dtype)
|
172
185
|
magic4 = NMatrix.new([4,4], [1, 15, 14, 4, 12, 6, 7, 9, 8, 10, 11, 5, 13, 3, 2, 16], dtype: dtype)
|
173
186
|
expect(b).to eq magic4
|
174
|
-
|
187
|
+
|
175
188
|
c = NMatrix.magic(6, dtype: dtype)
|
176
189
|
magic6 = NMatrix.new([6,6], [31, 9, 2, 22, 27, 20, 3, 32, 7, 21, 23, 25, 35, 1, 6, 26, 19, 24, 4, 36, 29, 13, 18, 11, 30, 5, 34, 12, 14, 16, 8, 28, 33, 17, 10, 15], dtype: dtype)
|
177
|
-
expect(c).to eq magic6
|
190
|
+
expect(c).to eq magic6
|
178
191
|
end
|
179
192
|
end
|
180
193
|
end
|
181
|
-
|
194
|
+
|
182
195
|
it "shape of two is not allowed" do
|
183
196
|
expect { NMatrix.magic(2) }.to raise_error(ArgumentError)
|
184
197
|
end
|
185
|
-
|
186
|
-
it "Only accepts an integer as dimension" do
|
198
|
+
|
199
|
+
it "Only accepts an integer as dimension" do
|
187
200
|
expect { NMatrix.magic(3.0) }.to raise_error(ArgumentError)
|
188
201
|
end
|
189
202
|
end
|
190
|
-
|
203
|
+
|
191
204
|
context "::linspace" do
|
192
205
|
it "creates a row vector when given only one shape parameter" do
|
206
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
193
207
|
v = NMatrix.linspace(1, 10, 4)
|
194
208
|
#Expect a row vector only
|
195
209
|
expect(v.shape.length).to eq(1)
|
196
|
-
|
210
|
+
|
197
211
|
ans = [1.0,4.0,7.0,10.0]
|
198
212
|
|
199
213
|
expect(v[0]).to be_within(0.000001).of(ans[0])
|
@@ -201,13 +215,14 @@ describe NMatrix do
|
|
201
215
|
expect(v[2]).to be_within(0.000001).of(ans[2])
|
202
216
|
expect(v[3]).to be_within(0.000001).of(ans[3])
|
203
217
|
end
|
204
|
-
|
218
|
+
|
205
219
|
it "creates a matrix of input shape with each entry linearly spaced in row major order" do
|
220
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
206
221
|
v = NMatrix.linspace(1, Math::PI, [2,2])
|
207
222
|
expect(v.dtype).to eq(:float64)
|
208
223
|
|
209
224
|
ans = [1.0, 1.7138642072677612, 2.4277284145355225, 3.1415927410125732]
|
210
|
-
|
225
|
+
|
211
226
|
expect(v[0,0]).to be_within(0.000001).of(ans[0])
|
212
227
|
expect(v[0,1]).to be_within(0.000001).of(ans[1])
|
213
228
|
expect(v[1,0]).to be_within(0.000001).of(ans[2])
|
@@ -217,13 +232,14 @@ describe NMatrix do
|
|
217
232
|
|
218
233
|
context "::logspace" do
|
219
234
|
it "creates a logarithmically spaced vector" do
|
235
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
220
236
|
v = NMatrix.logspace(1, 2, 10)
|
221
|
-
|
237
|
+
|
222
238
|
expect(v.shape.length).to eq(1)
|
223
|
-
|
239
|
+
|
224
240
|
#Unit test taken from Matlab R2015b output of logspace(1,2,10)
|
225
241
|
ans = [10.0000, 12.9155, 16.6810, 21.5443, 27.8256, 35.9381, 46.4159, 59.9484, 77.4264, 100.0000]
|
226
|
-
|
242
|
+
|
227
243
|
expect(v[0].round(4)).to be_within(0.000001).of(ans[0])
|
228
244
|
expect(v[1].round(4)).to be_within(0.000001).of(ans[1])
|
229
245
|
expect(v[2].round(4)).to be_within(0.000001).of(ans[2])
|
@@ -235,13 +251,14 @@ describe NMatrix do
|
|
235
251
|
expect(v[8].round(4)).to be_within(0.000001).of(ans[8])
|
236
252
|
expect(v[9].round(4)).to be_within(0.000001).of(ans[9])
|
237
253
|
end
|
238
|
-
|
254
|
+
|
239
255
|
it "creates a logarithmically spaced vector bounded by Math::PI if :pi is pre-supplied" do
|
256
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
240
257
|
v = NMatrix.logspace(1, :pi, 7)
|
241
|
-
|
258
|
+
|
242
259
|
#Unit test taken from Matlab R2015b output of logspace(1,pi,10)
|
243
260
|
ans = [10.0000, 8.2450, 6.7980, 5.6050, 4.6213, 3.8103, 3.1416]
|
244
|
-
|
261
|
+
|
245
262
|
expect(v[0].round(4)).to be_within(0.000001).of(ans[0])
|
246
263
|
expect(v[1].round(4)).to be_within(0.000001).of(ans[1])
|
247
264
|
expect(v[2].round(4)).to be_within(0.000001).of(ans[2])
|
@@ -249,13 +266,14 @@ describe NMatrix do
|
|
249
266
|
expect(v[4].round(4)).to be_within(0.000001).of(ans[4])
|
250
267
|
expect(v[5].round(4)).to be_within(0.000001).of(ans[5])
|
251
268
|
expect(v[6].round(4)).to be_within(0.000001).of(ans[6])
|
252
|
-
end
|
269
|
+
end
|
253
270
|
|
254
271
|
it "creates a matrix of input shape with each entry logarithmically spaced in row major order" do
|
272
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
255
273
|
v = NMatrix.logspace(1, 2, [3,2])
|
256
|
-
|
274
|
+
|
257
275
|
ans = [10.0, 15.8489, 25.1189, 39.8107, 63.0957, 100.0]
|
258
|
-
|
276
|
+
|
259
277
|
expect(v[0,0].round(4)).to be_within(0.000001).of(ans[0])
|
260
278
|
expect(v[0,1].round(4)).to be_within(0.000001).of(ans[1])
|
261
279
|
expect(v[1,0].round(4)).to be_within(0.000001).of(ans[2])
|
@@ -360,6 +378,7 @@ describe NMatrix do
|
|
360
378
|
end
|
361
379
|
|
362
380
|
it "should create an nmatrix of ones with dimensions and type the same as its argument" do
|
381
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
363
382
|
expect(NMatrix.ones_like(@nm_1d)).to eq NMatrix[1.0, 1.0, 1.0, 1.0, 1.0]
|
364
383
|
expect(NMatrix.ones_like(@nm_2d)).to eq NMatrix[[1.0, 1.0], [1.0, 1.0]]
|
365
384
|
end
|
@@ -383,6 +402,7 @@ describe "NVector" do
|
|
383
402
|
end
|
384
403
|
|
385
404
|
it "ones() creates a vector of ones" do
|
405
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
386
406
|
v = NVector.ones(3)
|
387
407
|
|
388
408
|
3.times do |i|
|
@@ -391,6 +411,7 @@ describe "NVector" do
|
|
391
411
|
end
|
392
412
|
|
393
413
|
it "random() creates a vector of random numbers" do
|
414
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
394
415
|
v = NVector.random(4)
|
395
416
|
expect(v.dtype).to eq(:float64)
|
396
417
|
expect(v.stype).to eq(:dense)
|
@@ -424,16 +445,19 @@ describe "NVector" do
|
|
424
445
|
end
|
425
446
|
|
426
447
|
it "cindgen() creates a vector of complexes, sequentially" do
|
448
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
427
449
|
v = NVector.cindgen(2)
|
428
450
|
expect(v).to eq(NMatrix.new([2,1], [Complex(0.0, 0.0), Complex(1.0, 0.0)], dtype: :complex64))
|
429
451
|
end
|
430
452
|
|
431
453
|
it "linspace() creates a vector with n values equally spaced between a and b" do
|
454
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
432
455
|
v = NVector.linspace(0, 2, 5)
|
433
456
|
expect(v).to eq(NMatrix.new([5,1], [0.0, 0.5, 1.0, 1.5, 2.0]))
|
434
457
|
end
|
435
458
|
|
436
459
|
it "logspace() creates a vector with n values logarithmically spaced between decades 10^a and 10^b" do
|
460
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
437
461
|
v = NVector.logspace(0, 3, 4)
|
438
462
|
expect(v).to eq(NMatrix.new([4,1], [1.0, 10.0, 100.0, 1000.0]))
|
439
463
|
end
|
data/spec/slice_set_spec.rb
CHANGED
@@ -40,8 +40,12 @@ describe "Set slice operation" do
|
|
40
40
|
|
41
41
|
if stype == :yale
|
42
42
|
step "verify correct arrangement of Yale IJA and A arrays" do
|
43
|
-
@m.extend NMatrix::YaleFunctions
|
44
|
-
|
43
|
+
@m.extend NMatrix::YaleFunctions unless jruby?
|
44
|
+
if jruby?
|
45
|
+
pending("not yet implemented for NMatrix-JRuby")
|
46
|
+
else
|
47
|
+
expect(@m.yale_ija).to eq([4,6,8,10,1,2,0,2,0,1])
|
48
|
+
end
|
45
49
|
expect(@m.yale_a).to eq([0,4,8,0, 1,2,3,5,6,7])
|
46
50
|
end
|
47
51
|
end
|
@@ -145,6 +149,7 @@ describe "Set slice operation" do
|
|
145
149
|
end
|
146
150
|
|
147
151
|
example "set a range of values to a matrix's contents" do
|
152
|
+
pending("not yet implemented for int dtype for NMatrix-JRuby") if jruby?
|
148
153
|
x = NMatrix.new(4, stype: :yale, dtype: :int16)
|
149
154
|
x.extend NMatrix::YaleFunctions if stype == :yale
|
150
155
|
x[1..3,1..3] = @m
|
data/spec/stat_spec.rb
CHANGED
@@ -41,6 +41,7 @@ describe "Statistical functions" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should calculate the mean along the specified dimension" do
|
44
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
44
45
|
unless stype == :yale then
|
45
46
|
puts nm_1d.mean
|
46
47
|
expect(nm_1d.mean).to eq NMatrix.new([1], [2.2], stype: stype, dtype: :float64)
|
@@ -50,27 +51,32 @@ describe "Statistical functions" do
|
|
50
51
|
end
|
51
52
|
|
52
53
|
it "should calculate the minimum along the specified dimension" do
|
54
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
53
55
|
expect(nm_1d.min).to eq 0.0 unless stype == :yale
|
54
56
|
expect(nm_2d.min).to eq NMatrix[[0.0, 1.0], stype: stype]
|
55
57
|
expect(nm_2d.min(1)).to eq NMatrix[[0.0], [2.0], stype: stype]
|
56
58
|
end
|
57
59
|
|
58
60
|
it "should calculate the maximum along the specified dimension" do
|
61
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
59
62
|
expect(nm_1d.max).to eq 5.0 unless stype == :yale
|
60
63
|
expect(nm_2d.max).to eq NMatrix[[2.0, 3.0], stype: stype]
|
61
64
|
end
|
62
65
|
|
63
66
|
it "should calculate the variance along the specified dimension" do
|
67
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
64
68
|
expect(nm_1d.variance).to eq NMatrix[3.7, stype: stype] unless stype == :yale
|
65
69
|
expect(nm_2d.variance(1)).to eq NMatrix[[0.5], [0.5], stype: stype]
|
66
70
|
end
|
67
71
|
|
68
72
|
it "should calculate the sum along the specified dimension" do
|
73
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
69
74
|
expect(nm_1d.sum).to eq NMatrix[11.0, stype: stype] unless stype == :yale
|
70
75
|
expect(nm_2d.sum).to eq NMatrix[[2.0, 4.0], stype: stype]
|
71
76
|
end
|
72
77
|
|
73
78
|
it "should calculate the standard deviation along the specified dimension" do
|
79
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
74
80
|
expect(nm_1d.std).to eq NMatrix[Math.sqrt(3.7), stype: stype] unless stype == :yale
|
75
81
|
expect(nm_2d.std(1)).to eq NMatrix[[Math.sqrt(0.5)], [Math.sqrt(0.5)], stype: stype]
|
76
82
|
end
|
@@ -128,6 +134,7 @@ describe "Statistical functions" do
|
|
128
134
|
end
|
129
135
|
|
130
136
|
it "should iterate correctly for reduce without a block" do
|
137
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
131
138
|
unless stype == :yale then
|
132
139
|
en = nm_1d.reduce_along_dim(0, 1.0)
|
133
140
|
expect(en.each { |a, e| a+e }.to_f).to eq 12
|
@@ -170,6 +177,7 @@ describe "Statistical functions" do
|
|
170
177
|
end
|
171
178
|
|
172
179
|
it "should allow overriding the dtype for reduce_along_dim" do
|
180
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
173
181
|
m = NMatrix[[1,2,3], [3,4,5], dtype: :complex128]
|
174
182
|
m.reduce_along_dim(1, 0.0, :float64) do |acc, sub_m|
|
175
183
|
expect(acc.dtype).to eq :float64
|
@@ -184,16 +192,19 @@ describe "Statistical functions" do
|
|
184
192
|
end
|
185
193
|
|
186
194
|
it "should convert integer dtypes to float when calculating mean" do
|
195
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
187
196
|
m = NMatrix[[1,2,3], [3,4,5], dtype: :int32, stype: stype]
|
188
197
|
expect(m.mean(0).dtype).to eq :float64
|
189
198
|
end
|
190
199
|
|
191
200
|
it "should convert integer dtypes to float when calculating variance" do
|
201
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
192
202
|
m = NMatrix[[1,2,3], [3,4,5], dtype: :int32, stype: stype]
|
193
203
|
expect(m.variance(0).dtype).to eq :float64
|
194
204
|
end
|
195
205
|
|
196
206
|
it "should convert integer dtypes to float when calculating standard deviation" do
|
207
|
+
pending("not yet implemented for NMatrix-JRuby") if jruby?
|
197
208
|
m = NMatrix[[1,2,3], [3,4,5], dtype: :int32, stype: stype]
|
198
209
|
expect(m.std(0).dtype).to eq :float64
|
199
210
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nmatrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Woods
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-12-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: packable
|
@@ -46,20 +46,6 @@ dependencies:
|
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '1.6'
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: json
|
51
|
-
requirement: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 2.0.1
|
56
|
-
type: :development
|
57
|
-
prerelease: false
|
58
|
-
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 2.0.1
|
63
49
|
- !ruby/object:Gem::Dependency
|
64
50
|
name: pry
|
65
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,7 +195,6 @@ files:
|
|
209
195
|
- ext/nmatrix/storage/yale/math/transpose.h
|
210
196
|
- ext/nmatrix/storage/yale/yale.cpp
|
211
197
|
- ext/nmatrix/storage/yale/yale.h
|
212
|
-
- ext/nmatrix/ttable_helper.rb
|
213
198
|
- ext/nmatrix/types.h
|
214
199
|
- ext/nmatrix/util/io.cpp
|
215
200
|
- ext/nmatrix/util/io.h
|
@@ -218,6 +203,7 @@ files:
|
|
218
203
|
- ext/nmatrix/util/util.h
|
219
204
|
- lib/nmatrix.rb
|
220
205
|
- lib/nmatrix/blas.rb
|
206
|
+
- lib/nmatrix/cruby/math.rb
|
221
207
|
- lib/nmatrix/enumerate.rb
|
222
208
|
- lib/nmatrix/homogeneous.rb
|
223
209
|
- lib/nmatrix/io/fortran_format.rb
|
@@ -226,6 +212,13 @@ files:
|
|
226
212
|
- lib/nmatrix/io/mat5_reader.rb
|
227
213
|
- lib/nmatrix/io/mat_reader.rb
|
228
214
|
- lib/nmatrix/io/point_cloud.rb
|
215
|
+
- lib/nmatrix/jruby/decomposition.rb
|
216
|
+
- lib/nmatrix/jruby/enumerable.rb
|
217
|
+
- lib/nmatrix/jruby/error.rb
|
218
|
+
- lib/nmatrix/jruby/math.rb
|
219
|
+
- lib/nmatrix/jruby/nmatrix_java.rb
|
220
|
+
- lib/nmatrix/jruby/operators.rb
|
221
|
+
- lib/nmatrix/jruby/slice.rb
|
229
222
|
- lib/nmatrix/lapack_core.rb
|
230
223
|
- lib/nmatrix/lapack_plugin.rb
|
231
224
|
- lib/nmatrix/math.rb
|
@@ -267,29 +260,15 @@ homepage: http://sciruby.com
|
|
267
260
|
licenses:
|
268
261
|
- BSD-3-Clause
|
269
262
|
metadata: {}
|
270
|
-
post_install_message:
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
ATLAS features, please check the README.
|
280
|
-
|
281
|
-
Faster matrix calculations and more advanced linear
|
282
|
-
algebra features are available by installing either
|
283
|
-
the nmatrix-atlas or nmatrix-lapacke plugins.
|
284
|
-
|
285
|
-
More explicit instructions for NMatrix and SciRuby should
|
286
|
-
be available on the SciRuby website, sciruby.com, or
|
287
|
-
through our mailing list (which can be found on our web-
|
288
|
-
site).
|
289
|
-
|
290
|
-
Thanks for trying out NMatrix! Happy coding!
|
291
|
-
|
292
|
-
***********************************************************
|
263
|
+
post_install_message: "***********************************************************\nWelcome
|
264
|
+
to SciRuby: Tools for Scientific Computing in Ruby!\n\nNMatrix requires a C/C++
|
265
|
+
compiler. Clang and GCC are \nrecommended. JRuby support is experimental, and requires\nJava.\n\nIf
|
266
|
+
you are upgrading from NMatrix 0.1.0 and rely on\nATLAS features, please check the
|
267
|
+
README.\n\nFaster matrix calculations and more advanced linear\nalgebra features
|
268
|
+
are available by installing either\nthe nmatrix-atlas or nmatrix-lapacke plugins.\n\nMore
|
269
|
+
explicit instructions for NMatrix and SciRuby should\nbe available on the SciRuby
|
270
|
+
website, sciruby.com, or\nthrough our mailing list (which can be found on our web-\nsite).\n\nThanks
|
271
|
+
for trying out NMatrix! Happy coding!\n\n***********************************************************\n"
|
293
272
|
rdoc_options: []
|
294
273
|
require_paths:
|
295
274
|
- lib
|
@@ -305,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
284
|
version: '0'
|
306
285
|
requirements: []
|
307
286
|
rubyforge_project:
|
308
|
-
rubygems_version: 2.
|
287
|
+
rubygems_version: 2.6.13
|
309
288
|
signing_key:
|
310
289
|
specification_version: 4
|
311
290
|
summary: NMatrix is a linear algebra library for Ruby
|
@@ -1,115 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
# A helper file for generating and maintaining template tables.
|
4
|
-
|
5
|
-
DTYPES = [
|
6
|
-
:uint8_t,
|
7
|
-
:int8_t,
|
8
|
-
:int16_t,
|
9
|
-
:int32_t,
|
10
|
-
:int64_t,
|
11
|
-
:float32_t,
|
12
|
-
:float64_t,
|
13
|
-
:'nm::Complex64',
|
14
|
-
:'nm::Complex128',
|
15
|
-
:'nm::RubyObject'
|
16
|
-
]
|
17
|
-
|
18
|
-
def nullify(disabled = []) #:nodoc:
|
19
|
-
DTYPES.map { |t| if disabled.include?(t) then :NULL else t end }
|
20
|
-
end
|
21
|
-
|
22
|
-
ITYPES = [
|
23
|
-
:uint8_t,
|
24
|
-
:uint16_t,
|
25
|
-
:uint32_t,
|
26
|
-
:uint64_t
|
27
|
-
]
|
28
|
-
|
29
|
-
EWOPS = [
|
30
|
-
:'nm::EW_ADD',
|
31
|
-
:'nm::EW_SUB',
|
32
|
-
:'nm::EW_MUL',
|
33
|
-
:'nm::EW_DIV',
|
34
|
-
:'nm::EW_POW',
|
35
|
-
:'nm::EW_MOD',
|
36
|
-
:'nm::EW_EQEQ',
|
37
|
-
:'nm::EW_NEQ',
|
38
|
-
:'nm::EW_LT',
|
39
|
-
:'nm::EW_GT',
|
40
|
-
:'nm::EW_LEQ',
|
41
|
-
:'nm::EW_GEQ'
|
42
|
-
]
|
43
|
-
|
44
|
-
LR_ALLOWED = {
|
45
|
-
:uint8_t => DTYPES,
|
46
|
-
:int8_t => DTYPES,
|
47
|
-
:int16_t => DTYPES,
|
48
|
-
:int32_t => DTYPES,
|
49
|
-
:int64_t => DTYPES,
|
50
|
-
:float32_t => DTYPES,
|
51
|
-
:float64_t => DTYPES,
|
52
|
-
:'nm::Complex64' => DTYPES,
|
53
|
-
:'nm::Complex128' => DTYPES,
|
54
|
-
:'nm::RubyObject' => DTYPES
|
55
|
-
}
|
56
|
-
|
57
|
-
lines =
|
58
|
-
case ARGV[0]
|
59
|
-
when 'OPLR'
|
60
|
-
'{' +
|
61
|
-
EWOPS.map do |op|
|
62
|
-
|
63
|
-
'{' +
|
64
|
-
DTYPES.map do |l_dtype|
|
65
|
-
|
66
|
-
'{' +
|
67
|
-
LR_ALLOWED[l_dtype].map do |r_dtype|
|
68
|
-
if r_dtype == :NULL
|
69
|
-
'NULL'
|
70
|
-
else
|
71
|
-
"fun<#{op}, #{l_dtype}, #{r_dtype}>"
|
72
|
-
end
|
73
|
-
end.join(', ') +
|
74
|
-
'}'
|
75
|
-
|
76
|
-
end.join(",\n") +
|
77
|
-
'}'
|
78
|
-
|
79
|
-
end.join(",\n") +
|
80
|
-
'}'
|
81
|
-
|
82
|
-
when 'OPID'
|
83
|
-
'{' +
|
84
|
-
EWOPS.map do |op|
|
85
|
-
'{' +
|
86
|
-
ITYPES.map do |itype|
|
87
|
-
'{' +
|
88
|
-
DTYPES.map do |dtype|
|
89
|
-
|
90
|
-
if dtype == :NULL
|
91
|
-
'NULL'
|
92
|
-
else
|
93
|
-
"fun<#{op}, #{itype}, #{dtype}>"
|
94
|
-
end
|
95
|
-
|
96
|
-
end.join(",") +
|
97
|
-
'}'
|
98
|
-
end.join(",\\\n") +
|
99
|
-
'}'
|
100
|
-
end.join(",\\\n") +
|
101
|
-
'}'
|
102
|
-
|
103
|
-
when 'LR'
|
104
|
-
'{' + DTYPES.map do |l_dtype|
|
105
|
-
'{' + LR_ALLOWED[l_dtype].map do |r_dtype|
|
106
|
-
if r_dtype == :NULL
|
107
|
-
'NULL'
|
108
|
-
else
|
109
|
-
"fun<#{l_dtype}, #{r_dtype}>"
|
110
|
-
end
|
111
|
-
end.join(', ') + '}'
|
112
|
-
end.join(",\n") + '}'
|
113
|
-
end
|
114
|
-
|
115
|
-
puts lines
|