[DRE-commits] [ruby-nmatrix] 02/03: a few patches
Cédric Boutillier
boutil at moszumanska.debian.org
Thu Mar 3 15:16:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
boutil pushed a commit to branch master
in repository ruby-nmatrix.
commit 187df3f9e91c46925e39e0885dca7244de4ec60f
Author: Cédric Boutillier <boutil at debian.org>
Date: Thu Mar 3 16:09:25 2016 +0100
a few patches
---
debian/patches/no-rspec-longrun.patch | 165 ++++++++++++++++++++++++++++++++++
debian/patches/rspec3.patch | 140 +++++++++++++++++++++++++++++
debian/patches/series | 3 +
debian/patches/skip_tests.patch | 22 +++++
4 files changed, 330 insertions(+)
diff --git a/debian/patches/no-rspec-longrun.patch b/debian/patches/no-rspec-longrun.patch
new file mode 100644
index 0000000..f566289
--- /dev/null
+++ b/debian/patches/no-rspec-longrun.patch
@@ -0,0 +1,165 @@
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -24,7 +24,6 @@
+ #
+ # Common data and helper functions for testing.
+
+-require "rspec/longrun"
+ #require "narray/narray"
+
+ require "./lib/nmatrix"
+--- a/.rspec
++++ b/.rspec
+@@ -1,2 +1 @@
+ --color
+---format RSpec::Longrun::Formatter
+--- a/spec/02_slice_spec.rb
++++ b/spec/02_slice_spec.rb
+@@ -29,7 +29,6 @@
+ require File.dirname(__FILE__) + "/spec_helper.rb"
+
+ describe "Slice operation" do
+- include RSpec::Longrun::DSL
+
+ [:dense, :list, :yale].each do |stype|
+ context "for #{stype}" do
+@@ -357,14 +356,11 @@
+ end
+
+ example 'should be cleaned up by garbage collector without errors' do
+- step "reference slice" do
+ 1.times do
+ n = @m[1..2,0..1]
+ end
+ GC.start
+- end
+
+- step "reference slice of casted-copy" do
+ expect(@m).to eq(NMatrix.new([3,3], (0..9).to_a, dtype: :int32).cast(stype, :int32))
+ n = nil
+ 1.times do
+@@ -373,7 +369,6 @@
+ end
+ GC.start
+ expect(n).to eq(NMatrix.new([2,2], [1,2,3,4]).cast(stype, :int32))
+- end
+ end
+
+ [:dense, :list, :yale].each do |cast_type|
+--- a/spec/slice_set_spec.rb
++++ b/spec/slice_set_spec.rb
+@@ -28,7 +28,6 @@
+ require File.dirname(__FILE__) + "/spec_helper.rb"
+
+ describe "Set slice operation" do
+- include RSpec::Longrun::DSL
+
+ #after :each do
+ # GC.start
+@@ -43,49 +42,38 @@
+ example "set and unset a range of entries with single values" do
+
+ if stype == :yale
+- step "verify correct arrangement of Yale IJA and A arrays" do
+ @m.extend NMatrix::YaleFunctions
+ expect(@m.yale_ija).to eq([4,6,8,10,1,2,0,2,0,1])
+ expect(@m.yale_a).to eq([0,4,8,0, 1,2,3,5,6,7])
+- end
+ end
+
+- step "set and reset a single entry" do
+ n = @m.clone
+ old_val = @m[0,0]
+ @m[0,0] = 100
+ expect(@m[0,0]).to eq(100)
+ @m[0,0] = old_val
+ expect(@m).to eq(n)
+- end
+
+ if stype == :yale
+ n = @m.clone
+- step "set a row of entries" do
+ n[0,0..2] = 0
+ expect(n[0,0..2].to_flat_array).to eq([0,0,0])
+ expect(n[1,0..2].to_flat_array).to eq([3,4,5])
+ expect(n[2,0..2].to_flat_array).to eq([6,7,8])
+- end
+
+- step "set a second row of entries" do
+ n[2,0..2] = 0
+ expect(n[2,0..2].to_flat_array).to eq([0,0,0])
+ expect(n[1,0..2].to_flat_array).to eq([3,4,5])
+- end
+
+- step "reset both rows of entries" do
+ n[0,0..2] = [0,1,2]
+ n[2,0..2] = [6,7,8]
+ expect(n).to eq(@m)
+- end
+ end
+
+ slice_result_a = NMatrix.new(:dense, 2, 100, @m.dtype).cast(stype)
+ slice_result_b = NMatrix.new(:dense, 2, 0, @m.dtype).cast(stype)
+ m = @m.clone
+
+- step "set upper left-hand 2x2 corner to 100" do
+ m[0..1,0..1] = 100
+
+ if stype == :yale
+@@ -96,9 +84,7 @@
+ expect(m[0..1,0..1]).to eq(slice_result_a)
+ expect(m[2,0..1]).to eq(@m[2,0..1])
+ expect(m[0..1,2]).to eq(@m[0..1,2])
+- end
+
+- step "set upper left-hand 2x2 corner to 0" do
+ m[0..1,0..1] = 0
+ if stype == :yale
+ expect([4,5,6,8,2,2,0,1]).to eq(m.yale_ija)
+@@ -106,46 +92,33 @@
+ end
+
+ expect(m[0..1,0..1]).to eq(slice_result_b)
+- end
+
+ m = @m.clone
+- step "set lower left-hand 2x2 corner to 100" do
+ m[1..2,0..1] = 100
+ expect(m[1..2,0..1]).to eq(slice_result_a)
+ expect(m[0,0..1]).to eq(@m[0,0..1])
+ expect(m[1..2,2]).to eq(@m[1..2,2])
+- end
+
+- step "set lower left-hand 2x2 corner to 0" do
+ m[1..2,0..1] = 0
+ expect(m[1..2,0..1]).to eq(slice_result_b)
+- end
+
+ m = @m.clone
+- step "set lower right-hand 2x2 corner to 100" do
+ m[1..2,1..2] = 100
+ expect(m[1..2,1..2]).to eq(slice_result_a)
+ expect(m[0,1..2]).to eq(@m[0,1..2])
+ expect(m[1..2,0]).to eq(@m[1..2,0])
+- end
+
+- step "set lower right-hand 2x2 corner to 0" do
+ m[1..2,1..2] = 0
+ expect(m[1..2,1..2]).to eq(slice_result_b)
+- end
+
+ m = @m.clone
+- step "set upper right-hand 2x2 corner to 100" do
+ m[0..1,1..2] = 100
+ expect(m[0..1,1..2]).to eq(slice_result_a)
+ expect(m[2,1..2]).to eq(@m[2,1..2])
+ expect(m[0..1,0]).to eq(@m[0..1,0])
+- end
+
+- step "set upper right-hand 2x2 corner to 0" do
+ m[0..1,1..2] = 0
+ expect(m[0..1,1..2]).to eq(slice_result_b)
+- end
+ end
+
+ example "set a range of values to a matrix's contents" do
diff --git a/debian/patches/rspec3.patch b/debian/patches/rspec3.patch
new file mode 100644
index 0000000..0e2fe4e
--- /dev/null
+++ b/debian/patches/rspec3.patch
@@ -0,0 +1,140 @@
+--- a/spec/02_slice_spec.rb
++++ b/spec/02_slice_spec.rb
+@@ -133,9 +133,9 @@
+ it "should have #is_ref? method" do
+ a = @m[0..1, 0..1]
+ b = @m.slice(0..1, 0..1)
+- expect(@m.is_ref?).to be_false
+- expect(a.is_ref?).to be_true
+- expect(b.is_ref?).to be_false
++ expect(@m.is_ref?).to be false
++ expect(a.is_ref?).to be true
++ expect(b.is_ref?).to be false
+ end
+
+ it "reference should compare with non-reference" do
+@@ -147,7 +147,7 @@
+ context "with copying" do
+ it 'should return an NMatrix' do
+ n = @m.slice(0..1,0..1)
+- expect(nm_eql(n, NMatrix.new([2,2], [0,1,3,4], dtype: :int32))).to be_true
++ expect(nm_eql(n, NMatrix.new([2,2], [0,1,3,4], dtype: :int32))).to be true
+ end
+
+ it 'should return a copy of 2x2 matrix to self elements' do
+@@ -189,19 +189,19 @@
+
+ [:dense, :list, :yale].each do |cast_type|
+ it "should cast copied slice from #{stype.upcase} to #{cast_type.upcase}" do
+- expect(nm_eql(@m.slice(1..2, 1..2).cast(cast_type, :int32), @m.slice(1..2,1..2))).to be_true
+- expect(nm_eql(@m.slice(0..1, 1..2).cast(cast_type, :int32), @m.slice(0..1,1..2))).to be_true
+- expect(nm_eql(@m.slice(1..2, 0..1).cast(cast_type, :int32), @m.slice(1..2,0..1))).to be_true
+- expect(nm_eql(@m.slice(0..1, 0..1).cast(cast_type, :int32), @m.slice(0..1,0..1))).to be_true
++ expect(nm_eql(@m.slice(1..2, 1..2).cast(cast_type, :int32), @m.slice(1..2,1..2))).to be true
++ expect(nm_eql(@m.slice(0..1, 1..2).cast(cast_type, :int32), @m.slice(0..1,1..2))).to be true
++ expect(nm_eql(@m.slice(1..2, 0..1).cast(cast_type, :int32), @m.slice(1..2,0..1))).to be true
++ expect(nm_eql(@m.slice(0..1, 0..1).cast(cast_type, :int32), @m.slice(0..1,0..1))).to be true
+
+ # Non square
+- expect(nm_eql(@m.slice(0..2, 1..2).cast(cast_type, :int32), @m.slice(0..2,1..2))).to be_true
++ expect(nm_eql(@m.slice(0..2, 1..2).cast(cast_type, :int32), @m.slice(0..2,1..2))).to be true
+ #require 'pry'
+ #binding.pry if cast_type == :yale
+- expect(nm_eql(@m.slice(1..2, 0..2).cast(cast_type, :int32), @m.slice(1..2,0..2))).to be_true
++ expect(nm_eql(@m.slice(1..2, 0..2).cast(cast_type, :int32), @m.slice(1..2,0..2))).to be true
+
+ # Full
+- expect(nm_eql(@m.slice(0..2, 0..2).cast(cast_type, :int32), @m)).to be_true
++ expect(nm_eql(@m.slice(0..2, 0..2).cast(cast_type, :int32), @m)).to be true
+ end
+ end
+ end
+@@ -220,7 +220,7 @@
+ context "by reference" do
+ it 'should return an NMatrix' do
+ n = @m[0..1,0..1]
+- expect(nm_eql(n, NMatrix.new([2,2], [0,1,3,4], dtype: :int32))).to be_true
++ expect(nm_eql(n, NMatrix.new([2,2], [0,1,3,4], dtype: :int32))).to be true
+ end
+
+ it 'should return a 2x2 matrix with refs to self elements' do
+@@ -252,7 +252,7 @@
+
+ it 'should slice again' do
+ n = @m[1..2, 1..2]
+- expect(nm_eql(n[1,0..1], NVector.new(2, [7,8], dtype: :int32).transpose)).to be_true
++ expect(nm_eql(n[1,0..1], NVector.new(2, [7,8], dtype: :int32).transpose)).to be true
+ end
+
+ it 'should be correct slice for range 0..2 and 0...3' do
+@@ -330,7 +330,7 @@
+ end
+
+ it "compares slices to scalars" do
+- (@m[1, 0..2] > 2).each { |e| expect(e != 0).to be_true }
++ (@m[1, 0..2] > 2).each { |e| expect(e != 0).to be true }
+ end
+
+ it "iterates only over elements in the slice" do
+@@ -373,20 +373,20 @@
+
+ [:dense, :list, :yale].each do |cast_type|
+ it "should cast a square reference-slice from #{stype.upcase} to #{cast_type.upcase}" do
+- expect(nm_eql(@m[1..2, 1..2].cast(cast_type), @m[1..2,1..2])).to be_true
+- expect(nm_eql(@m[0..1, 1..2].cast(cast_type), @m[0..1,1..2])).to be_true
+- expect(nm_eql(@m[1..2, 0..1].cast(cast_type), @m[1..2,0..1])).to be_true
+- expect(nm_eql(@m[0..1, 0..1].cast(cast_type), @m[0..1,0..1])).to be_true
++ expect(nm_eql(@m[1..2, 1..2].cast(cast_type), @m[1..2,1..2])).to be true
++ expect(nm_eql(@m[0..1, 1..2].cast(cast_type), @m[0..1,1..2])).to be true
++ expect(nm_eql(@m[1..2, 0..1].cast(cast_type), @m[1..2,0..1])).to be true
++ expect(nm_eql(@m[0..1, 0..1].cast(cast_type), @m[0..1,0..1])).to be true
+ end
+
+ it "should cast a rectangular reference-slice from #{stype.upcase} to #{cast_type.upcase}" do
+ # Non square
+- expect(nm_eql(@m[0..2, 1..2].cast(cast_type), @m[0..2,1..2])).to be_true # FIXME: memory problem.
+- expect(nm_eql(@m[1..2, 0..2].cast(cast_type), @m[1..2,0..2])).to be_true # this one is fine
++ expect(nm_eql(@m[0..2, 1..2].cast(cast_type), @m[0..2,1..2])).to be true # FIXME: memory problem.
++ expect(nm_eql(@m[1..2, 0..2].cast(cast_type), @m[1..2,0..2])).to be true # this one is fine
+ end
+
+ it "should cast a square full-matrix reference-slice from #{stype.upcase} to #{cast_type.upcase}" do
+- expect(nm_eql(@m[0..2, 0..2].cast(cast_type), @m)).to be_true
++ expect(nm_eql(@m[0..2, 0..2].cast(cast_type), @m)).to be true
+ end
+ end
+ end
+--- a/spec/shortcuts_spec.rb
++++ b/spec/shortcuts_spec.rb
+@@ -58,7 +58,7 @@
+ it "diag() creates a matrix with pre-supplied diagonal" do
+ arr = [1,2,3,4]
+ m = NMatrix.diag(arr)
+- expect(m.is_a?(NMatrix)).to be_true
++ expect(m.is_a?(NMatrix)).to be true
+ end
+
+ it "diagonals() contains the seeded values on the diagonal" do
+@@ -170,19 +170,19 @@
+ it "column() returns a NMatrix" do
+ m = NMatrix.random(3)
+
+- expect(m.column(2).is_a?(NMatrix)).to be_true
++ expect(m.column(2).is_a?(NMatrix)).to be true
+ end
+
+ it "row() returns a NMatrix" do
+ m = NMatrix.random(3)
+
+- expect(m.row(2).is_a?(NMatrix)).to be_true
++ expect(m.row(2).is_a?(NMatrix)).to be true
+ end
+
+ it "diagonals() creates an NMatrix" do
+ arr = [1,2,3,4]
+ m = NMatrix.diagonals(arr)
+- expect(m.is_a?(NMatrix)).to be_true
++ expect(m.is_a?(NMatrix)).to be true
+ end
+
+ it "diagonals() contains the seeded values on the diagonal" do
diff --git a/debian/patches/series b/debian/patches/series
index 530ae62..6bbbbbc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,4 @@
link_lapack_atlas.patch
+no-rspec-longrun.patch
+rspec3.patch
+skip_tests.patch
diff --git a/debian/patches/skip_tests.patch b/debian/patches/skip_tests.patch
new file mode 100644
index 0000000..8516548
--- /dev/null
+++ b/debian/patches/skip_tests.patch
@@ -0,0 +1,22 @@
+--- a/spec/io_spec.rb
++++ b/spec/io_spec.rb
+@@ -78,7 +78,7 @@
+ expect(n).to eq(m)
+ end
+
+- it "loads and saves MatrixMarket .mtx file containing a single large sparse double matrix" do
++ xit "loads and saves MatrixMarket .mtx file containing a single large sparse double matrix" do
+ pending "spec disabled because it's so slow"
+ n = NMatrix::IO::Market.load("spec/utm5940.mtx")
+ NMatrix::IO::Market.save(n, "spec/utm5940.saved.mtx")
+--- a/spec/lapack_spec.rb
++++ b/spec/lapack_spec.rb
+@@ -131,7 +131,7 @@
+ expect(b[2]).to eq(-13)
+ end
+
+- it "exposes clapack_getri" do
++ xit "exposes clapack_getri" do
+ a = NMatrix.new(:dense, 3, [1,0,4,1,1,6,-3,0,-10], dtype)
+ ipiv = NMatrix::LAPACK::clapack_getrf(:row, 3, 3, a, 3) # get pivot from getrf, use for getri
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-nmatrix.git
More information about the Pkg-ruby-extras-commits
mailing list