extendmatrix 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +3 -0
- data/lib/extendmatrix.rb +3 -3
- data/spec/extendmatrix_spec.rb +7 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/extendmatrix.rb
CHANGED
@@ -217,7 +217,7 @@ end
|
|
217
217
|
|
218
218
|
class Matrix
|
219
219
|
|
220
|
-
EXTENSION_VERSION="0.2.
|
220
|
+
EXTENSION_VERSION="0.2.2"
|
221
221
|
include Enumerable
|
222
222
|
|
223
223
|
attr_reader :rows, :wrap
|
@@ -312,10 +312,10 @@ class Matrix
|
|
312
312
|
end
|
313
313
|
|
314
314
|
#
|
315
|
-
# Return a duplicate matrix
|
315
|
+
# Return a duplicate matrix, with all elements copied
|
316
316
|
#
|
317
317
|
def dup
|
318
|
-
|
318
|
+
(self.class).rows(self.rows.dup)
|
319
319
|
end
|
320
320
|
|
321
321
|
def initialize_copy(orig)
|
data/spec/extendmatrix_spec.rb
CHANGED
@@ -238,7 +238,13 @@ describe "Matrix class extension:" do
|
|
238
238
|
[0, 0, 0, 3]]
|
239
239
|
Matrix.diag(m2, m2).should == a2
|
240
240
|
end
|
241
|
-
|
241
|
+
it "dup" do
|
242
|
+
m=Matrix.build(4, 3){|i, j| i * 3 + j +1}
|
243
|
+
mm=m.dup
|
244
|
+
mm.object_id.should_not==m.object_id
|
245
|
+
m[0,0]=10
|
246
|
+
mm[0,0].should_not==m[0,0]
|
247
|
+
end
|
242
248
|
it "equal_in_delta" do
|
243
249
|
m = Matrix.build(4, 3){|i, j| i * 3 + j +1}
|
244
250
|
Matrix.equal_in_delta?(m, m).should == true
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|