mdarray 0.5.4-java → 0.5.5-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 +35 -16
- data/README.md +180 -234
- data/lib/colt/matrix/algebra.rb +466 -0
- data/lib/colt/matrix/colt_matrix.rb +161 -220
- data/lib/colt/matrix/creation.rb +374 -0
- data/lib/colt/matrix/{matrix_hierarchy.rb → hierarchy.rb} +78 -99
- data/lib/colt/matrix/property.rb +363 -0
- data/lib/mdarray/views.rb +46 -1
- data/test/colt/matrix/test_complete.rb +29 -0
- data/test/colt/{test_matrix.rb → matrix/test_creation.rb} +26 -3
- data/test/colt/{test_double_matrix2d.rb → matrix/test_matrix1d_floatingalgebra.rb} +86 -84
- data/test/colt/matrix/test_matrix2d_fixpointalgebra.rb +531 -0
- data/test/colt/matrix/test_matrix2d_floatingalgebra.rb +693 -0
- data/test/colt/matrix/test_operations.rb +120 -0
- data/test/colt/matrix/test_properties.rb +649 -0
- data/test/colt/test_complete.rb +1 -1
- data/test/complete.rb +12 -7
- data/test/mdarray/test_views.rb +55 -0
- data/vendor/{incanter.jar → mdarray.jar} +0 -0
- data/version.rb +1 -1
- metadata +22 -16
- data/lib/colt/matrix/matrix2D_floating_algebra.rb +0 -325
- data/test/colt/test_float_matrix2d.rb +0 -171
- data/vendor/commons-compiler.jar +0 -0
- data/vendor/janino.jar +0 -0
@@ -0,0 +1,374 @@
|
|
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 for educational, research, and
|
6
|
+
# not-for-profit purposes, without fee and without a signed licensing agreement, is hereby
|
7
|
+
# granted, provided that the above copyright notice, this paragraph and the following two
|
8
|
+
# paragraphs appear in all copies, modifications, and distributions. Contact Rodrigo
|
9
|
+
# Botafogo - rodrigo.a.botafogo@gmail.com for commercial licensing opportunities.
|
10
|
+
#
|
11
|
+
# IN NO EVENT SHALL RODRIGO BOTAFOGO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
12
|
+
# INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
13
|
+
# THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RODRIGO BOTAFOGO HAS BEEN ADVISED OF THE
|
14
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
15
|
+
#
|
16
|
+
# RODRIGO BOTAFOGO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
17
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
|
18
|
+
# SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
|
19
|
+
# RODRIGO BOTAFOGO HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
|
20
|
+
# OR MODIFICATIONS.
|
21
|
+
##########################################################################################
|
22
|
+
|
23
|
+
require 'java'
|
24
|
+
|
25
|
+
class MDMatrix
|
26
|
+
|
27
|
+
#------------------------------------------------------------------------------------
|
28
|
+
#
|
29
|
+
#------------------------------------------------------------------------------------
|
30
|
+
|
31
|
+
def self.build(type, shape, storage = nil)
|
32
|
+
if (shape.size > 3)
|
33
|
+
raise "Cannot create MDMatrix of size greater than 3"
|
34
|
+
end
|
35
|
+
self.from_mdarray(MDArray.build(type, shape, storage))
|
36
|
+
end
|
37
|
+
|
38
|
+
#------------------------------------------------------------------------------------
|
39
|
+
#
|
40
|
+
#------------------------------------------------------------------------------------
|
41
|
+
|
42
|
+
def self.double(shape, storage = nil)
|
43
|
+
self.build("double", shape, storage)
|
44
|
+
end
|
45
|
+
|
46
|
+
#------------------------------------------------------------------------------------
|
47
|
+
#
|
48
|
+
#------------------------------------------------------------------------------------
|
49
|
+
|
50
|
+
def self.float(shape, storage = nil)
|
51
|
+
self.build("float", shape, storage)
|
52
|
+
end
|
53
|
+
|
54
|
+
#------------------------------------------------------------------------------------
|
55
|
+
#
|
56
|
+
#------------------------------------------------------------------------------------
|
57
|
+
|
58
|
+
def self.long(shape, storage = nil)
|
59
|
+
self.build("long", shape, storage)
|
60
|
+
end
|
61
|
+
|
62
|
+
#------------------------------------------------------------------------------------
|
63
|
+
#
|
64
|
+
#------------------------------------------------------------------------------------
|
65
|
+
|
66
|
+
def self.int(shape, storage = nil)
|
67
|
+
self.build("int", shape, storage)
|
68
|
+
end
|
69
|
+
|
70
|
+
#------------------------------------------------------------------------------------
|
71
|
+
# Creates a MDMatrix from an MDArray.
|
72
|
+
# (int rows, int columns, double[] elements, int rowZero, int columnZero,
|
73
|
+
# int rowStride, int columnStride, boolean isView)
|
74
|
+
#------------------------------------------------------------------------------------
|
75
|
+
|
76
|
+
def self.from_mdarray(mdarray)
|
77
|
+
|
78
|
+
case mdarray.rank
|
79
|
+
|
80
|
+
when 1
|
81
|
+
dense1D(mdarray)
|
82
|
+
when 2
|
83
|
+
dense2D(mdarray)
|
84
|
+
when 3
|
85
|
+
dense3D(mdarray)
|
86
|
+
else
|
87
|
+
raise "Cannot create MDMatrix of rank greater than 3"
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
#------------------------------------------------------------------------------------
|
93
|
+
# Creates a new MDMatrix from a given colt_matrix
|
94
|
+
#------------------------------------------------------------------------------------
|
95
|
+
|
96
|
+
def self.from_colt_matrix(colt_matrix)
|
97
|
+
|
98
|
+
if (colt_matrix.is_a? DenseDoubleMatrix3D)
|
99
|
+
mdarray = MDArray.from_jstorage("double",
|
100
|
+
[colt_matrix.slices, colt_matrix.rows,
|
101
|
+
colt_matrix.columns], colt_matrix.elements)
|
102
|
+
return DoubleMDMatrix3D.from_mdarray(mdarray)
|
103
|
+
elsif (colt_matrix.is_a? DenseFloatMatrix3D)
|
104
|
+
mdarray = MDArray.from_jstorage("float",
|
105
|
+
[colt_matrix.slices, colt_matrix.rows,
|
106
|
+
colt_matrix.columns], colt_matrix.elements)
|
107
|
+
return FloatMDMatrix3D.from_mdarray(mdarray)
|
108
|
+
elsif (colt_matrix.is_a? DenseLongMatrix3D)
|
109
|
+
mdarray = MDArray.from_jstorage("long",
|
110
|
+
[colt_matrix.slices, colt_matrix.rows,
|
111
|
+
colt_matrix.columns], colt_matrix.elements)
|
112
|
+
return LongMDMatrix3D.from_mdarray(mdarray)
|
113
|
+
elsif (colt_matrix.is_a? DenseIntMatrix3D)
|
114
|
+
mdarray = MDArray.from_jstorage("int",
|
115
|
+
[colt_matrix.slices, colt_matrix.rows,
|
116
|
+
colt_matrix.columns], colt_matrix.elements)
|
117
|
+
return IntMDMatrix3D.from_mdarray(mdarray)
|
118
|
+
elsif (colt_matrix.is_a? DenseDoubleMatrix2D)
|
119
|
+
mdarray = MDArray.from_jstorage("double", [colt_matrix.rows, colt_matrix.columns],
|
120
|
+
colt_matrix.elements)
|
121
|
+
return DoubleMDMatrix2D.from_mdarray(mdarray)
|
122
|
+
elsif (colt_matrix.is_a? DenseFloatMatrix2D)
|
123
|
+
mdarray = MDArray.from_jstorage("float", [colt_matrix.rows, colt_matrix.columns],
|
124
|
+
colt_matrix.elements)
|
125
|
+
return FloatMDMatrix2D.from_mdarray(mdarray)
|
126
|
+
elsif (colt_matrix.is_a? DenseLongMatrix2D)
|
127
|
+
mdarray = MDArray.from_jstorage("long", [colt_matrix.rows, colt_matrix.columns],
|
128
|
+
colt_matrix.elements)
|
129
|
+
return LongMDMatrix2D.from_mdarray(mdarray)
|
130
|
+
elsif (colt_matrix.is_a? DenseIntMatrix2D)
|
131
|
+
mdarray = MDArray.from_jstorage("int", [colt_matrix.rows, colt_matrix.columns],
|
132
|
+
colt_matrix.elements)
|
133
|
+
return IntMDMatrix2D.from_mdarray(mdarray)
|
134
|
+
elsif (colt_matrix.is_a? DenseDoubleMatrix1D)
|
135
|
+
mdarray = MDArray.from_jstorage("double", [colt_matrix.size], colt_matrix.elements)
|
136
|
+
return DoubleMDMatrix1D.from_mdarray(mdarray)
|
137
|
+
elsif (colt_matrix.is_a? DenseFloatMatrix1D)
|
138
|
+
mdarray = MDArray.from_jstorage("float", [colt_matrix.size], colt_matrix.elements)
|
139
|
+
return FloatMDMatrix1D.from_mdarray(mdarray)
|
140
|
+
elsif (colt_matrix.is_a? DenseLongMatrix1D)
|
141
|
+
mdarray = MDArray.from_jstorage("long", [colt_matrix.size], colt_matrix.elements)
|
142
|
+
return LongMDMatrix1D.from_mdarray(mdarray)
|
143
|
+
elsif (colt_matrix.is_a? DenseIntMatrix1D)
|
144
|
+
mdarray = MDArray.from_jstorage("int", [colt_matrix.size], colt_matrix.elements)
|
145
|
+
return IntMDMatrix1D.from_mdarray(mdarray)
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
#------------------------------------------------------------------------------------
|
151
|
+
#
|
152
|
+
#------------------------------------------------------------------------------------
|
153
|
+
|
154
|
+
def self.fromfunction(type, shape, &block)
|
155
|
+
|
156
|
+
mdarray = MDArray.fromfunction(type, shape, &block)
|
157
|
+
MDMatrix.from_mdarray(mdarray)
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
#------------------------------------------------------------------------------------
|
162
|
+
#
|
163
|
+
#------------------------------------------------------------------------------------
|
164
|
+
|
165
|
+
def self.init_with(type, shape, value)
|
166
|
+
mdarray = MDArray.init_with(type, shape, value)
|
167
|
+
MDMatrix.from_mdarray(mdarray)
|
168
|
+
end
|
169
|
+
|
170
|
+
#------------------------------------------------------------------------------------
|
171
|
+
#
|
172
|
+
#------------------------------------------------------------------------------------
|
173
|
+
|
174
|
+
def self.arange(*args)
|
175
|
+
mdarray = MDArray.arange(*args)
|
176
|
+
MDMatrix.from_mdarray(mdarray)
|
177
|
+
end
|
178
|
+
|
179
|
+
#------------------------------------------------------------------------------------
|
180
|
+
#
|
181
|
+
#------------------------------------------------------------------------------------
|
182
|
+
|
183
|
+
def self.typed_arange(type, *args)
|
184
|
+
mdarray = MDArray.typed_arange(type, *args)
|
185
|
+
MDMatrix.from_mdarray(mdarray)
|
186
|
+
end
|
187
|
+
|
188
|
+
#------------------------------------------------------------------------------------
|
189
|
+
#
|
190
|
+
#------------------------------------------------------------------------------------
|
191
|
+
|
192
|
+
def self.linspace(type, start, stop, number)
|
193
|
+
mdarray = MDArray.linspace(type, start, stop, number)
|
194
|
+
MDMatrix.from_mdarray(mdarray)
|
195
|
+
end
|
196
|
+
|
197
|
+
#------------------------------------------------------------------------------------
|
198
|
+
#
|
199
|
+
#------------------------------------------------------------------------------------
|
200
|
+
|
201
|
+
def self.ones(type, shape)
|
202
|
+
mdarray = MDArray.ones(type, shape)
|
203
|
+
MDMatrix.from_mdarray(mdarray)
|
204
|
+
end
|
205
|
+
|
206
|
+
#------------------------------------------------------------------------------------
|
207
|
+
#
|
208
|
+
#------------------------------------------------------------------------------------
|
209
|
+
|
210
|
+
def copy
|
211
|
+
MDMatrix.from_mdarray(self.mdarray.copy)
|
212
|
+
end
|
213
|
+
|
214
|
+
#------------------------------------------------------------------------------------
|
215
|
+
#
|
216
|
+
#------------------------------------------------------------------------------------
|
217
|
+
|
218
|
+
private
|
219
|
+
|
220
|
+
#------------------------------------------------------------------------------------
|
221
|
+
# Only Floating Matrices have algebra. Long and Int matrices do not have algebra.
|
222
|
+
#------------------------------------------------------------------------------------
|
223
|
+
|
224
|
+
def initialize(mdarray, colt_matrix, colt_property, colt_algebra = nil)
|
225
|
+
@mdarray = mdarray
|
226
|
+
@colt_matrix = colt_matrix
|
227
|
+
@colt_property = colt_property
|
228
|
+
@colt_algebra = colt_algebra
|
229
|
+
@rank = @mdarray.rank
|
230
|
+
@coerced = false # should never be changed by any client
|
231
|
+
end
|
232
|
+
|
233
|
+
#------------------------------------------------------------------------------------
|
234
|
+
#
|
235
|
+
#------------------------------------------------------------------------------------
|
236
|
+
|
237
|
+
def self.dense1D(mdarray)
|
238
|
+
|
239
|
+
storage = mdarray.nc_array.getStorage()
|
240
|
+
index = mdarray.nc_array.getIndex()
|
241
|
+
size = index.size
|
242
|
+
|
243
|
+
klass = index.getClass
|
244
|
+
field = klass.getDeclaredField("stride0")
|
245
|
+
field.setAccessible true
|
246
|
+
stride0 = field.get(index)
|
247
|
+
# p stride0
|
248
|
+
|
249
|
+
klass = klass.getSuperclass()
|
250
|
+
field = klass.getDeclaredField("offset")
|
251
|
+
field.setAccessible true
|
252
|
+
offset = field.get(index)
|
253
|
+
# p offset
|
254
|
+
|
255
|
+
case mdarray.type
|
256
|
+
when "double"
|
257
|
+
colt_matrix = DenseDoubleMatrix1D.new(size, storage, offset, stride0, false)
|
258
|
+
DoubleMDMatrix1D.new(mdarray, colt_matrix)
|
259
|
+
when "float"
|
260
|
+
colt_matrix = DenseFloatMatrix1D.new(size, storage, offset, stride0, false)
|
261
|
+
FloatMDMatrix1D.new(mdarray, colt_matrix)
|
262
|
+
when "long"
|
263
|
+
colt_matrix = DenseLongMatrix1D.new(size, storage, offset, stride0, false)
|
264
|
+
LongMDMatrix1D.new(mdarray, colt_matrix)
|
265
|
+
when "int"
|
266
|
+
colt_matrix = DenseIntMatrix1D.new(size, storage, offset, stride0, false)
|
267
|
+
IntMDMatrix1D.new(mdarray, colt_matrix)
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
271
|
+
|
272
|
+
#------------------------------------------------------------------------------------
|
273
|
+
#
|
274
|
+
#------------------------------------------------------------------------------------
|
275
|
+
|
276
|
+
def self.dense2D(mdarray)
|
277
|
+
|
278
|
+
storage = mdarray.nc_array.getStorage()
|
279
|
+
index = mdarray.nc_array.getIndex()
|
280
|
+
shape = index.getShape()
|
281
|
+
|
282
|
+
klass = index.getClass
|
283
|
+
field = klass.getDeclaredField("stride0")
|
284
|
+
field.setAccessible true
|
285
|
+
stride0 = field.get(index)
|
286
|
+
# p stride0
|
287
|
+
|
288
|
+
field = klass.getDeclaredField("stride1")
|
289
|
+
field.setAccessible true
|
290
|
+
stride1 = field.get(index)
|
291
|
+
# p stride1
|
292
|
+
|
293
|
+
klass = klass.getSuperclass()
|
294
|
+
field = klass.getDeclaredField("offset")
|
295
|
+
field.setAccessible true
|
296
|
+
offset = field.get(index)
|
297
|
+
# p offset
|
298
|
+
|
299
|
+
case mdarray.type
|
300
|
+
when "double"
|
301
|
+
colt_matrix = DenseDoubleMatrix2D.new(shape[0], shape[1], storage, offset, 0,
|
302
|
+
stride0, stride1, false)
|
303
|
+
DoubleMDMatrix2D.new(mdarray, colt_matrix)
|
304
|
+
when "float"
|
305
|
+
colt_matrix = DenseFloatMatrix2D.new(shape[0], shape[1], storage, offset, 0,
|
306
|
+
stride0, stride1, false)
|
307
|
+
FloatMDMatrix2D.new(mdarray, colt_matrix)
|
308
|
+
when "long"
|
309
|
+
colt_matrix = DenseLongMatrix2D.new(shape[0], shape[1], storage, offset, 0,
|
310
|
+
stride0, stride1, false)
|
311
|
+
LongMDMatrix2D.new(mdarray, colt_matrix)
|
312
|
+
when "int"
|
313
|
+
colt_matrix = DenseIntMatrix2D.new(shape[0], shape[1], storage, offset, 0,
|
314
|
+
stride0, stride1, false)
|
315
|
+
IntMDMatrix2D.new(mdarray, colt_matrix)
|
316
|
+
end
|
317
|
+
|
318
|
+
end
|
319
|
+
|
320
|
+
#------------------------------------------------------------------------------------
|
321
|
+
#
|
322
|
+
#------------------------------------------------------------------------------------
|
323
|
+
|
324
|
+
def self.dense3D(mdarray)
|
325
|
+
|
326
|
+
storage = mdarray.nc_array.getStorage()
|
327
|
+
index = mdarray.nc_array.getIndex()
|
328
|
+
shape = index.getShape()
|
329
|
+
|
330
|
+
klass = index.getClass
|
331
|
+
field = klass.getDeclaredField("stride0")
|
332
|
+
field.setAccessible true
|
333
|
+
stride0 = field.get(index)
|
334
|
+
# p stride0
|
335
|
+
|
336
|
+
field = klass.getDeclaredField("stride1")
|
337
|
+
field.setAccessible true
|
338
|
+
stride1 = field.get(index)
|
339
|
+
# p stride1
|
340
|
+
|
341
|
+
field = klass.getDeclaredField("stride2")
|
342
|
+
field.setAccessible true
|
343
|
+
stride2 = field.get(index)
|
344
|
+
# p stride2
|
345
|
+
|
346
|
+
klass = klass.getSuperclass()
|
347
|
+
field = klass.getDeclaredField("offset")
|
348
|
+
field.setAccessible true
|
349
|
+
offset = field.get(index)
|
350
|
+
# p offset
|
351
|
+
|
352
|
+
case mdarray.type
|
353
|
+
when "double"
|
354
|
+
colt_matrix = DenseDoubleMatrix3D.new(shape[0], shape[1], shape[2], storage,
|
355
|
+
offset, 0, 0, stride0, stride1, stride2, false)
|
356
|
+
DoubleMDMatrix3D.new(mdarray, colt_matrix)
|
357
|
+
when "float"
|
358
|
+
colt_matrix = DenseFloatMatrix3D.new(shape[0], shape[1], shape[2], storage,
|
359
|
+
offset, 0, 0, stride0, stride1, stride2, false)
|
360
|
+
FloatMDMatrix3D.new(mdarray, colt_matrix)
|
361
|
+
when "long"
|
362
|
+
colt_matrix = DenseLongMatrix3D.new(shape[0], shape[1], shape[2], storage,
|
363
|
+
offset, 0, 0, stride0, stride1, stride2, false)
|
364
|
+
LongMDMatrix3D.new(mdarray, colt_matrix)
|
365
|
+
when "int"
|
366
|
+
colt_matrix = DenseIntMatrix3D.new(shape[0], shape[1], shape[2], storage,
|
367
|
+
offset, 0, 0, stride0, stride1, stride2, false)
|
368
|
+
IntMDMatrix3D.new(mdarray, colt_matrix)
|
369
|
+
end
|
370
|
+
|
371
|
+
end
|
372
|
+
|
373
|
+
end # MDMatrix
|
374
|
+
|
@@ -20,146 +20,144 @@
|
|
20
20
|
# OR MODIFICATIONS.
|
21
21
|
##########################################################################################
|
22
22
|
|
23
|
-
|
24
23
|
##########################################################################################
|
25
|
-
# Floating point
|
24
|
+
# Floating point Matrices
|
26
25
|
##########################################################################################
|
27
26
|
|
28
|
-
class
|
29
|
-
|
30
|
-
end # FloatingMDMatrix1D
|
27
|
+
class FloatingMDMatrix < MDMatrix
|
31
28
|
|
32
|
-
|
33
|
-
#
|
34
|
-
|
29
|
+
#------------------------------------------------------------------------------------
|
30
|
+
#
|
31
|
+
#------------------------------------------------------------------------------------
|
35
32
|
|
36
|
-
|
37
|
-
include_package "cern.colt.matrix.tdouble.algo"
|
33
|
+
private
|
38
34
|
|
39
35
|
#------------------------------------------------------------------------------------
|
40
36
|
#
|
41
37
|
#------------------------------------------------------------------------------------
|
42
38
|
|
43
|
-
def initialize(mdarray, colt_matrix)
|
44
|
-
super(mdarray, colt_matrix)
|
45
|
-
@algebra = DenseDoubleAlgebra.new
|
39
|
+
def initialize(mdarray, colt_matrix, algebra)
|
40
|
+
super(mdarray, colt_matrix, algebra.property(), algebra)
|
46
41
|
end
|
47
42
|
|
48
|
-
end
|
43
|
+
end
|
49
44
|
|
50
45
|
##########################################################################################
|
51
46
|
#
|
52
47
|
##########################################################################################
|
53
48
|
|
54
|
-
class
|
55
|
-
include_package "cern.colt.matrix.
|
49
|
+
class DoubleMDMatrix < FloatingMDMatrix
|
50
|
+
include_package "cern.colt.matrix.tdouble.algo"
|
56
51
|
|
57
52
|
#------------------------------------------------------------------------------------
|
58
53
|
#
|
59
54
|
#------------------------------------------------------------------------------------
|
60
55
|
|
61
|
-
def initialize(mdarray, colt_matrix)
|
62
|
-
super(mdarray, colt_matrix)
|
63
|
-
@algebra = DenseFloatAlgebra.new
|
56
|
+
def initialize(mdarray, colt_matrix, tolerance = nil)
|
57
|
+
super(mdarray, colt_matrix, DenseDoubleAlgebra.new)
|
64
58
|
end
|
65
59
|
|
66
|
-
end #
|
60
|
+
end # DoubleMDMatrix
|
61
|
+
|
62
|
+
##########################################################################################
|
63
|
+
#
|
64
|
+
##########################################################################################
|
67
65
|
|
66
|
+
class DoubleMDMatrix1D < DoubleMDMatrix
|
68
67
|
|
68
|
+
end # DoubleMDMatrix1D
|
69
69
|
|
70
70
|
##########################################################################################
|
71
|
-
#
|
71
|
+
#
|
72
72
|
##########################################################################################
|
73
73
|
|
74
|
-
class
|
74
|
+
class DoubleMDMatrix2D < DoubleMDMatrix
|
75
75
|
|
76
|
-
end #
|
76
|
+
end # DoubleMDMatrix2D
|
77
77
|
|
78
78
|
##########################################################################################
|
79
79
|
#
|
80
80
|
##########################################################################################
|
81
81
|
|
82
|
-
class
|
83
|
-
include_package "cern.colt.matrix.tdouble.algo"
|
82
|
+
class DoubleMDMatrix3D < DoubleMDMatrix
|
84
83
|
|
85
|
-
|
86
|
-
#
|
87
|
-
#------------------------------------------------------------------------------------
|
84
|
+
end # DoubleMDMatrix3D
|
88
85
|
|
89
|
-
def initialize(mdarray, colt_matrix)
|
90
|
-
super(mdarray, colt_matrix)
|
91
|
-
@algebra = DenseDoubleAlgebra.new
|
92
|
-
end
|
93
86
|
|
94
|
-
end # DoubleMDMatrix
|
95
87
|
|
96
88
|
##########################################################################################
|
97
89
|
#
|
98
90
|
##########################################################################################
|
99
91
|
|
100
|
-
class
|
92
|
+
class FloatMDMatrix < FloatingMDMatrix
|
101
93
|
include_package "cern.colt.matrix.tfloat.algo"
|
102
94
|
|
103
95
|
#------------------------------------------------------------------------------------
|
104
96
|
#
|
105
97
|
#------------------------------------------------------------------------------------
|
106
98
|
|
107
|
-
def initialize(mdarray, colt_matrix)
|
108
|
-
super(mdarray, colt_matrix)
|
109
|
-
@algebra = DenseFloatAlgebra.new
|
99
|
+
def initialize(mdarray, colt_matrix, tolerance = nil)
|
100
|
+
super(mdarray, colt_matrix, DenseFloatAlgebra.new)
|
110
101
|
end
|
111
102
|
|
112
103
|
end # FloatMDMatrix
|
113
104
|
|
105
|
+
##########################################################################################
|
106
|
+
#
|
107
|
+
##########################################################################################
|
114
108
|
|
109
|
+
class FloatMDMatrix1D < FloatMDMatrix
|
115
110
|
|
111
|
+
end # FloatMDMatrix1D
|
116
112
|
|
117
113
|
|
118
114
|
##########################################################################################
|
119
115
|
#
|
120
116
|
##########################################################################################
|
121
117
|
|
122
|
-
class
|
123
|
-
include_package "cern.colt.matrix.tdouble.algo"
|
124
|
-
|
125
|
-
#------------------------------------------------------------------------------------
|
126
|
-
#
|
127
|
-
#------------------------------------------------------------------------------------
|
118
|
+
class FloatMDMatrix2D < FloatMDMatrix
|
128
119
|
|
129
|
-
|
130
|
-
super(mdarray, colt_matrix)
|
131
|
-
@algebra = DenseDoubleAlgebra.new
|
132
|
-
end
|
120
|
+
end # FloatMDMatrix2D
|
133
121
|
|
134
|
-
end # DoubleMDMatrix
|
135
122
|
|
136
123
|
##########################################################################################
|
137
124
|
#
|
138
125
|
##########################################################################################
|
139
126
|
|
140
|
-
class FloatMDMatrix3D <
|
141
|
-
|
127
|
+
class FloatMDMatrix3D < FloatMDMatrix
|
128
|
+
|
129
|
+
end # FloatMDMatrix3D
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
##########################################################################################
|
134
|
+
# Floating point Matrices
|
135
|
+
##########################################################################################
|
136
|
+
|
137
|
+
class FixPointMDMatrix < MDMatrix
|
142
138
|
|
143
139
|
#------------------------------------------------------------------------------------
|
144
140
|
#
|
145
141
|
#------------------------------------------------------------------------------------
|
146
142
|
|
147
|
-
|
148
|
-
super(mdarray, colt_matrix)
|
149
|
-
@algebra = DenseFloatAlgebra.new
|
150
|
-
end
|
151
|
-
|
152
|
-
end # FloatMDMatrix
|
143
|
+
private
|
153
144
|
|
145
|
+
#------------------------------------------------------------------------------------
|
146
|
+
#
|
147
|
+
#------------------------------------------------------------------------------------
|
154
148
|
|
149
|
+
def initialize(mdarray, colt_matrix, property)
|
150
|
+
super(mdarray, colt_matrix, property)
|
151
|
+
end
|
155
152
|
|
153
|
+
end # FixPointMDMatrix
|
156
154
|
|
157
155
|
|
158
156
|
##########################################################################################
|
159
157
|
#
|
160
158
|
##########################################################################################
|
161
159
|
|
162
|
-
class
|
160
|
+
class LongMDMatrix < FixPointMDMatrix
|
163
161
|
include_package "cern.colt.matrix.tlong.algo"
|
164
162
|
|
165
163
|
#------------------------------------------------------------------------------------
|
@@ -167,7 +165,7 @@ class LongMDMatrix1D < MDMatrix
|
|
167
165
|
#------------------------------------------------------------------------------------
|
168
166
|
|
169
167
|
def initialize(mdarray, colt_matrix)
|
170
|
-
super(mdarray, colt_matrix)
|
168
|
+
super(mdarray, colt_matrix, LongProperty.new)
|
171
169
|
end
|
172
170
|
|
173
171
|
end # LongMDMatrix
|
@@ -176,41 +174,32 @@ end # LongMDMatrix
|
|
176
174
|
#
|
177
175
|
##########################################################################################
|
178
176
|
|
179
|
-
class
|
180
|
-
include_package "cern.colt.matrix.tlong.algo"
|
177
|
+
class LongMDMatrix1D < LongMDMatrix
|
181
178
|
|
182
|
-
|
183
|
-
#
|
184
|
-
#------------------------------------------------------------------------------------
|
179
|
+
end # LongMDMatrix1D
|
185
180
|
|
186
|
-
|
187
|
-
|
188
|
-
|
181
|
+
##########################################################################################
|
182
|
+
#
|
183
|
+
##########################################################################################
|
189
184
|
|
190
|
-
|
185
|
+
class LongMDMatrix2D < LongMDMatrix
|
186
|
+
|
187
|
+
end # LongMDMatrix2D
|
191
188
|
|
192
189
|
##########################################################################################
|
193
190
|
#
|
194
191
|
##########################################################################################
|
195
192
|
|
196
|
-
class LongMDMatrix3D <
|
197
|
-
include_package "cern.colt.matrix.tlong.algo"
|
198
|
-
|
199
|
-
#------------------------------------------------------------------------------------
|
200
|
-
#
|
201
|
-
#------------------------------------------------------------------------------------
|
193
|
+
class LongMDMatrix3D < LongMDMatrix
|
202
194
|
|
203
|
-
|
204
|
-
super(mdarray, colt_matrix)
|
205
|
-
end
|
195
|
+
end # LongMDMatrix3D
|
206
196
|
|
207
|
-
end # LongMDMatrix
|
208
197
|
|
209
198
|
##########################################################################################
|
210
199
|
#
|
211
200
|
##########################################################################################
|
212
201
|
|
213
|
-
class
|
202
|
+
class IntMDMatrix < FixPointMDMatrix
|
214
203
|
include_package "cern.colt.matrix.tint.algo"
|
215
204
|
|
216
205
|
#------------------------------------------------------------------------------------
|
@@ -218,7 +207,7 @@ class IntMDMatrix1D < MDMatrix
|
|
218
207
|
#------------------------------------------------------------------------------------
|
219
208
|
|
220
209
|
def initialize(mdarray, colt_matrix)
|
221
|
-
super(mdarray, colt_matrix)
|
210
|
+
super(mdarray, colt_matrix, IntProperty.new)
|
222
211
|
end
|
223
212
|
|
224
213
|
end # IntMDMatrix
|
@@ -227,32 +216,22 @@ end # IntMDMatrix
|
|
227
216
|
#
|
228
217
|
##########################################################################################
|
229
218
|
|
230
|
-
class
|
231
|
-
include_package "cern.colt.matrix.tint.algo"
|
232
|
-
|
233
|
-
#------------------------------------------------------------------------------------
|
234
|
-
#
|
235
|
-
#------------------------------------------------------------------------------------
|
236
|
-
|
237
|
-
def initialize(mdarray, colt_matrix)
|
238
|
-
super(mdarray, colt_matrix)
|
239
|
-
end
|
219
|
+
class IntMDMatrix1D < IntMDMatrix
|
240
220
|
|
241
|
-
end #
|
221
|
+
end # IntMDMatrix1D
|
242
222
|
|
243
223
|
##########################################################################################
|
244
224
|
#
|
245
225
|
##########################################################################################
|
246
226
|
|
247
|
-
class
|
248
|
-
include_package "cern.colt.matrix.tint.algo"
|
227
|
+
class IntMDMatrix2D < IntMDMatrix
|
249
228
|
|
250
|
-
|
251
|
-
#
|
252
|
-
#------------------------------------------------------------------------------------
|
229
|
+
end # IntMDMatrix2D
|
253
230
|
|
254
|
-
|
255
|
-
|
256
|
-
|
231
|
+
##########################################################################################
|
232
|
+
#
|
233
|
+
##########################################################################################
|
257
234
|
|
258
|
-
|
235
|
+
class IntMDMatrix3D < IntMDMatrix
|
236
|
+
|
237
|
+
end # IntMDMatrix3D
|