spec/stat_spec.rb in nmatrix-atlas-0.2.3 vs spec/stat_spec.rb in nmatrix-atlas-0.2.4

- old
+ new

@@ -39,40 +39,46 @@ expect(nm_1d.reduce_along_dim(0) { |acc, el| acc + el }.to_f).to eq 11 unless stype == :yale expect(nm_2d.reduce_along_dim(1) { |acc, el| acc + el }).to eq NMatrix.new([2,1], [1.0, 5.0], stype: stype) end it "should calculate the mean along the specified dimension" do + pending("not yet implemented for NMatrix-JRuby") if jruby? unless stype == :yale then puts nm_1d.mean expect(nm_1d.mean).to eq NMatrix.new([1], [2.2], stype: stype, dtype: :float64) end expect(nm_2d.mean).to eq NMatrix[[1.0,2.0], stype: stype] expect(nm_2d.mean(1)).to eq NMatrix[[0.5], [2.5], stype: stype] end it "should calculate the minimum along the specified dimension" do + pending("not yet implemented for NMatrix-JRuby") if jruby? expect(nm_1d.min).to eq 0.0 unless stype == :yale expect(nm_2d.min).to eq NMatrix[[0.0, 1.0], stype: stype] expect(nm_2d.min(1)).to eq NMatrix[[0.0], [2.0], stype: stype] end it "should calculate the maximum along the specified dimension" do + pending("not yet implemented for NMatrix-JRuby") if jruby? expect(nm_1d.max).to eq 5.0 unless stype == :yale expect(nm_2d.max).to eq NMatrix[[2.0, 3.0], stype: stype] end it "should calculate the variance along the specified dimension" do + pending("not yet implemented for NMatrix-JRuby") if jruby? expect(nm_1d.variance).to eq NMatrix[3.7, stype: stype] unless stype == :yale expect(nm_2d.variance(1)).to eq NMatrix[[0.5], [0.5], stype: stype] end it "should calculate the sum along the specified dimension" do + pending("not yet implemented for NMatrix-JRuby") if jruby? expect(nm_1d.sum).to eq NMatrix[11.0, stype: stype] unless stype == :yale expect(nm_2d.sum).to eq NMatrix[[2.0, 4.0], stype: stype] end it "should calculate the standard deviation along the specified dimension" do + pending("not yet implemented for NMatrix-JRuby") if jruby? expect(nm_1d.std).to eq NMatrix[Math.sqrt(3.7), stype: stype] unless stype == :yale expect(nm_2d.std(1)).to eq NMatrix[[Math.sqrt(0.5)], [Math.sqrt(0.5)], stype: stype] end it "should raise an ArgumentError when any invalid dimension is provided" do @@ -126,10 +132,11 @@ en = nm_2d.map expect(en.each { |e| e**2 }).to eq nm_2d.map { |e| e**2 } end it "should iterate correctly for reduce without a block" do + pending("not yet implemented for NMatrix-JRuby") if jruby? unless stype == :yale then en = nm_1d.reduce_along_dim(0, 1.0) expect(en.each { |a, e| a+e }.to_f).to eq 12 end en = nm_2d.reduce_along_dim(1, 1.0) @@ -168,10 +175,11 @@ acc end end it "should allow overriding the dtype for reduce_along_dim" do + pending("not yet implemented for NMatrix-JRuby") if jruby? m = NMatrix[[1,2,3], [3,4,5], dtype: :complex128] m.reduce_along_dim(1, 0.0, :float64) do |acc, sub_m| expect(acc.dtype).to eq :float64 acc end @@ -182,19 +190,22 @@ acc end end it "should convert integer dtypes to float when calculating mean" do + pending("not yet implemented for NMatrix-JRuby") if jruby? m = NMatrix[[1,2,3], [3,4,5], dtype: :int32, stype: stype] expect(m.mean(0).dtype).to eq :float64 end it "should convert integer dtypes to float when calculating variance" do + pending("not yet implemented for NMatrix-JRuby") if jruby? m = NMatrix[[1,2,3], [3,4,5], dtype: :int32, stype: stype] expect(m.variance(0).dtype).to eq :float64 end it "should convert integer dtypes to float when calculating standard deviation" do + pending("not yet implemented for NMatrix-JRuby") if jruby? m = NMatrix[[1,2,3], [3,4,5], dtype: :int32, stype: stype] expect(m.std(0).dtype).to eq :float64 end end end