nmatrix-atlas 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8354f8106f72d4db13f480b406d21d81c1c3061
4
- data.tar.gz: 878df29d3440005024e197b7184f1b4719ff03b1
3
+ metadata.gz: 2dfd9e03007c9d53d16501ae158cad281cbf688c
4
+ data.tar.gz: 372cfafc9724678d7dea5de8ec9f5903a9e7ba5c
5
5
  SHA512:
6
- metadata.gz: f48fa616231c0bcf7106078692a5ce5f1aa4be489eb688c2e1189943a0d4ebd8f7670d09696942d6181c09b40b52ca76dda11ed15af904b70f819e6ed4950045
7
- data.tar.gz: 13552a53662684eb6dead7a9530b68046bb4659d8103695be97a6b448e1bab5b0e336b457d3dc86f30fad54b7e42058e56904e7a0d6d8b8fe1c4f7f066b6f01d
6
+ metadata.gz: 20c40c463319f137c429fafe8a082ba4e380fc2d409a42b1c5ac2c807ed4f7bf5a42257f61c551a235412a0ed6e359403fe85068ef808d924750e419302f8741
7
+ data.tar.gz: 25932614b9dd335189f9cc317e4168599983e1137c235b16145e4d95288b4767bf9c7f8136c78e6249439483fc457e7c0c7dcbcd441fd2e52c1b1cd75bc41cf8
@@ -110,7 +110,7 @@ class RubyObject {
110
110
  inline operator VALUE() const { return rval; }
111
111
  //inline operator uint32_t() const { return NUM2ULONG(this->rval); }
112
112
  inline operator int64_t() const { RETURN_OBJ2NUM(NUM2LONG) }
113
- inline operator uint64_t() const { RETURN_OBJ2NUM(NUM2ULONG) }
113
+ //inline operator uint64_t() const { RETURN_OBJ2NUM(NUM2ULONG) }
114
114
  inline operator double() const { RETURN_OBJ2NUM(NUM2DBL) }
115
115
  inline operator float() const { RETURN_OBJ2NUM(NUM2DBL) }
116
116
 
@@ -102,8 +102,14 @@ extern "C" {
102
102
  void nm_math_solve(VALUE lu, VALUE b, VALUE x, VALUE ipiv);
103
103
  void nm_math_inverse(const int M, void* A_elements, nm::dtype_t dtype);
104
104
  void nm_math_hessenberg(VALUE a);
105
- void nm_math_det_exact(const int M, const void* elements, const int lda, nm::dtype_t dtype, void* result);
106
- void nm_math_inverse_exact(const int M, const void* A_elements, const int lda, void* B_elements, const int ldb, nm::dtype_t dtype);
105
+ void nm_math_det_exact_from_dense(const int M, const void* elements,
106
+ const int lda, nm::dtype_t dtype, void* result);
107
+ void nm_math_det_exact_from_yale(const int M, const YALE_STORAGE* storage,
108
+ const int lda, nm::dtype_t dtype, void* result);
109
+ void nm_math_inverse_exact_from_dense(const int M, const void* A_elements,
110
+ const int lda, void* B_elements, const int ldb, nm::dtype_t dtype);
111
+ void nm_math_inverse_exact_from_yale(const int M, const YALE_STORAGE* storage,
112
+ const int lda, YALE_STORAGE* inverse, const int ldb, nm::dtype_t dtype);
107
113
  }
108
114
 
109
115
 
@@ -41,8 +41,71 @@ describe NMatrix do
41
41
  expect { n[0] }.to raise_error(ArgumentError)
42
42
  end
43
43
 
44
- it "calculates exact determinants on small square matrices" do
44
+ it "calculates exact determinants on small dense matrices" do
45
45
  expect(NMatrix.new(2, [1,2,3,4], stype: :dense, dtype: :int64).det_exact).to eq(-2)
46
+ expect(NMatrix.new(3, [1,2,3,0,5,6,7,8,0], stype: :dense, dtype: :int64)
47
+ .det_exact).to eq(-69)
48
+ end
49
+
50
+ it "calculates exact determinants on small yale square matrices" do
51
+ expect(NMatrix.new(2, [1,2,3,4], stype: :yale, dtype: :int64).det_exact).to eq(-2)
52
+ expect(NMatrix.new(3, [1,2,3,0,5,6,7,8,0], stype: :yale, dtype: :int64)
53
+ .det_exact).to eq(-69)
54
+ end
55
+
56
+ it "calculates exact determinants on small list square matrices" do
57
+ expect(NMatrix.new(2, [1,2,3,4], stype: :list, dtype: :int64).det_exact).to eq(-2)
58
+ expect(NMatrix.new(3, [1,2,3,0,5,6,7,8,0], stype: :list, dtype: :int64)
59
+ .det_exact).to eq(-69)
60
+ end
61
+
62
+ it "calculates inverse exact determinants on small dense matrices" do
63
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
64
+ a = NMatrix.new(3, [1,2,3,0,1,4,5,6,0], stype: :dense, dtype: :int64)
65
+ inversed = a.method(:__inverse_exact__).call(a.clone, 3, 3)
66
+ b = NMatrix.new(3, [-24,18,5,20,-15,-4,-5,4,1], stype: :dense, dtype: :int64)
67
+ expect(inversed).to eq(b)
68
+
69
+ c = NMatrix.new(3, [1,0,3,0,0,1,0,6,0], stype: :dense, dtype: :int64)
70
+ inversed = c.method(:__inverse_exact__).call(c.clone, 3, 3)
71
+ d = NMatrix.new(3, [1,-3,0,0,0,0,0,1,0], stype: :dense, dtype: :int64)
72
+ expect(inversed).to eq(d)
73
+
74
+ e = NMatrix.new(2, [3,1,2,1], stype: :dense, dtype: :int64)
75
+ inversed = e.method(:__inverse_exact__).call(e.clone, 2, 2)
76
+ f = NMatrix.new(2, [1,-1,-2,3], stype: :dense, dtype: :int64)
77
+ expect(inversed).to eq(f)
78
+ end
79
+
80
+ it "calculates inverse exact determinants on small yale matrices" do
81
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
82
+ a = NMatrix.new(3, [1,2,3,0,1,4,5,6,0], stype: :yale, dtype: :int64)
83
+ inversed = a.method(:__inverse_exact__).call(a.clone, 3, 3)
84
+ b = NMatrix.new(3, [-24,18,5,20,-15,-4,-5,4,1], stype: :yale, dtype: :int64)
85
+ expect(inversed).to eq(b)
86
+
87
+ c = NMatrix.new(3, [1,0,3,0,0,1,0,6,0], stype: :yale, dtype: :int64)
88
+ inversed = c.method(:__inverse_exact__).call(c.clone, 3, 3)
89
+ d = NMatrix.new(3, [1,-3,0,0,0,0,0,1,0], stype: :yale, dtype: :int64)
90
+ expect(inversed).to eq(d)
91
+
92
+ e = NMatrix.new(2, [3,1,2,1], stype: :yale, dtype: :int64)
93
+ inversed = e.method(:__inverse_exact__).call(e.clone, 2, 2)
94
+ f = NMatrix.new(2, [1,-1,-2,3], stype: :yale, dtype: :int64)
95
+ expect(inversed).to eq(f)
96
+ end
97
+
98
+ it "calculates inverse exact determinants on small list matrices" do
99
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
100
+ a = NMatrix.new(3, [1,2,3,0,1,4,5,6,0], stype: :list, dtype: :int64)
101
+ inversed = a.method(:__inverse_exact__).call(a.clone, 3, 3)
102
+ b = NMatrix.new(3, [-24,18,5,20,-15,-4,-5,4,1], stype: :list, dtype: :int64)
103
+ expect(inversed).to eq(b)
104
+
105
+ c = NMatrix.new(2, [3,1,2,1], stype: :list, dtype: :int64)
106
+ inversed = c.method(:__inverse_exact__).call(c.clone, 2, 2)
107
+ d = NMatrix.new(2, [1,-1,-2,3], stype: :list, dtype: :int64)
108
+ expect(inversed).to eq(d)
46
109
  end
47
110
 
48
111
  it "calculates determinants" do
@@ -56,6 +119,7 @@ describe NMatrix do
56
119
  end
57
120
 
58
121
  it "allows casting from Ruby objects" do
122
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
59
123
  m = NMatrix.new(:dense, [3,3], [0,0,1,0,2,0,3,4,5], :object)
60
124
  n = m.cast(:dense, :int64)
61
125
  expect(m).to eq(n)
@@ -78,6 +142,7 @@ describe NMatrix do
78
142
 
79
143
  it "fills dense Ruby object matrix with nil" do
80
144
  n = NMatrix.new([4,3], dtype: :object)
145
+ pending("not yet implemented for object dtype for NMatrix-JRuby") if jruby?
81
146
  expect(n[0,0]).to eq(nil)
82
147
  end
83
148
 
@@ -146,6 +211,7 @@ describe NMatrix do
146
211
 
147
212
  it "dense handles missing initialization value" do
148
213
  n = NMatrix.new(3, dtype: :int8)
214
+ pending("not yet implemented for int dtype for NMatrix-JRuby") if jruby?
149
215
  expect(n.stype).to eq(:dense)
150
216
  expect(n.dtype).to eq(:int8)
151
217
 
@@ -158,6 +224,8 @@ describe NMatrix do
158
224
  context storage_type do
159
225
  it "can be duplicated" do
160
226
  n = NMatrix.new([2,3], 1.1, stype: storage_type, dtype: :float64)
227
+ # FIXME
228
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby? #and storage_type != :dense
161
229
  expect(n.stype).to eq(storage_type)
162
230
 
163
231
  n[0,0] = 0.0
@@ -223,6 +291,7 @@ describe NMatrix do
223
291
  end
224
292
 
225
293
  it "allows storage-based iteration of matrices" do
294
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby? and storage_type != :dense
226
295
  STDERR.puts storage_type.inspect
227
296
  STDERR.puts dtype.inspect
228
297
  n = NMatrix.new([3,3], 0, stype: storage_type, dtype: dtype)
@@ -263,6 +332,7 @@ describe NMatrix do
263
332
  # dense and list, not yale
264
333
  context "(storage: #{storage_type})" do
265
334
  it "gets default value" do
335
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
266
336
  expect(NMatrix.new(3, 0, stype: storage_type)[1,1]).to eq(0)
267
337
  expect(NMatrix.new(3, 0.1, stype: storage_type)[1,1]).to eq(0.1)
268
338
  expect(NMatrix.new(3, 1, stype: storage_type)[1,1]).to eq(1)
@@ -321,12 +391,16 @@ describe NMatrix do
321
391
 
322
392
  context "dense" do
323
393
  it "should return the matrix being iterated over when each is called with a block" do
394
+ # FIXME
395
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
324
396
  a = NMatrix.new(2, 1)
325
397
  val = (a.each { })
326
398
  expect(val).to eq(a)
327
399
  end
328
400
 
329
401
  it "should return the matrix being iterated over when each_stored_with_indices is called with a block" do
402
+ # FIXME
403
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
330
404
  a = NMatrix.new(2,1)
331
405
  val = (a.each_stored_with_indices { })
332
406
  expect(val).to eq(a)
@@ -336,12 +410,14 @@ describe NMatrix do
336
410
  [:list, :yale].each do |storage_type|
337
411
  context storage_type do
338
412
  it "should return the matrix being iterated over when each_stored_with_indices is called with a block" do
413
+ pending("not yet implemented for Complex dtype for NMatrix-JRuby") if jruby?
339
414
  n = NMatrix.new([2,3], 1.1, stype: storage_type, dtype: :float64, default: 0)
340
415
  val = (n.each_stored_with_indices { })
341
416
  expect(val).to eq(n)
342
417
  end
343
418
 
344
419
  it "should return an enumerator when each_stored_with_indices is called without a block" do
420
+ pending("not yet implemented for Complex dtype for NMatrix-JRuby") if jruby?
345
421
  n = NMatrix.new([2,3], 1.1, stype: storage_type, dtype: :float64, default: 0)
346
422
  val = n.each_stored_with_indices
347
423
  expect(val).to be_a Enumerator
@@ -405,11 +481,15 @@ describe 'NMatrix' do
405
481
 
406
482
  context "#reshape" do
407
483
  it "should change the shape of a matrix without the contents changing" do
484
+ # FIXME
485
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
408
486
  n = NMatrix.seq(4)+1
409
487
  expect(n.reshape([8,2]).to_flat_array).to eq(n.to_flat_array)
410
488
  end
411
489
 
412
490
  it "should permit a change of dimensionality" do
491
+ # FIXME
492
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
413
493
  n = NMatrix.seq(4)+1
414
494
  expect(n.reshape([8,1,2]).to_flat_array).to eq(n.to_flat_array)
415
495
  end
@@ -425,6 +505,8 @@ describe 'NMatrix' do
425
505
  end
426
506
 
427
507
  it "should do the reshape operation in place, changing dimension" do
508
+ # FIXME
509
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
428
510
  n = NMatrix.seq(4)
429
511
  a = n.reshape!([4,2,2])
430
512
  expect(n).to eq(NMatrix.seq([4,2,2]))
@@ -432,6 +514,8 @@ describe 'NMatrix' do
432
514
  end
433
515
 
434
516
  it "reshape and reshape! must produce same result" do
517
+ # FIXME
518
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
435
519
  n = NMatrix.seq(4)+1
436
520
  a = NMatrix.seq(4)+1
437
521
  expect(n.reshape!([8,2])==a.reshape(8,2)).to eq(true) # because n itself changes
@@ -481,6 +565,8 @@ describe 'NMatrix' do
481
565
  [:dense].each do |stype| # list storage transpose not yet implemented
482
566
  context(stype) do # yale support only 2-dim matrix
483
567
  it "should work like vector product on a #{stype} (1-dimensional)" do
568
+ # FIXME
569
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
484
570
  m = NMatrix.new([3], [1,2,3], stype: stype)
485
571
  expect(m.dot(m)).to eq (NMatrix.new([1],[14]))
486
572
  end
@@ -538,6 +624,8 @@ describe 'NMatrix' do
538
624
  end
539
625
 
540
626
  it "should permit depth concatenation on tensors" do
627
+ # FIXME
628
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
541
629
  n = NMatrix.new([1,3,1], [1,2,3])
542
630
  expect(n.dconcat(n)).to eq(NMatrix.new([1,3,2], [1,1,2,2,3,3]))
543
631
  end
@@ -548,6 +636,8 @@ describe 'NMatrix' do
548
636
  m = N[[7],
549
637
  [8]]
550
638
 
639
+ # FIXME
640
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
551
641
  expect(n.hconcat(m)).to eq N[[1, 2, 3, 7], [4, 5, 6, 8]]
552
642
  expect(m.hconcat(n)).to eq N[[7, 1, 2, 3], [8, 4, 5, 6]]
553
643
  end
@@ -558,6 +648,8 @@ describe 'NMatrix' do
558
648
 
559
649
  m = N[[7, 8, 9]]
560
650
 
651
+ # FIXME
652
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
561
653
  expect(n.vconcat(m)).to eq N[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
562
654
  expect(m.vconcat(n)).to eq N[[7, 8, 9], [1, 2, 3], [4, 5, 6]]
563
655
  end
@@ -582,6 +674,7 @@ describe 'NMatrix' do
582
674
  context(stype) do
583
675
  it "should work in-place for complex dtypes" do
584
676
  pending("not yet implemented for list stype") if stype == :list
677
+ pending("not yet implemented for Complex dtype for NMatrix-JRuby") if jruby?
585
678
  n = NMatrix.new([2,3], [Complex(2,3)], stype: stype, dtype: :complex128)
586
679
  n.complex_conjugate!
587
680
  expect(n).to eq(NMatrix.new([2,3], [Complex(2,-3)], stype: stype, dtype: :complex128))
@@ -590,6 +683,7 @@ describe 'NMatrix' do
590
683
  [:object, :int64].each do |dtype|
591
684
  it "should work in-place for non-complex dtypes" do
592
685
  pending("not yet implemented for list stype") if stype == :list
686
+ pending("not yet implemented for Complex dtype for NMatrix-JRuby") if jruby?
593
687
  n = NMatrix.new([2,3], 1, stype: stype, dtype: dtype)
594
688
  n.complex_conjugate!
595
689
  expect(n).to eq(NMatrix.new([2,3], [1], stype: stype, dtype: dtype))
@@ -604,6 +698,7 @@ describe 'NMatrix' do
604
698
  context(stype) do
605
699
  it "should work out-of-place for complex dtypes" do
606
700
  pending("not yet implemented for list stype") if stype == :list
701
+ pending("not yet implemented for Complex dtype for NMatrix-JRuby") if jruby?
607
702
  n = NMatrix.new([2,3], [Complex(2,3)], stype: stype, dtype: :complex128)
608
703
  expect(n.complex_conjugate).to eq(NMatrix.new([2,3], [Complex(2,-3)], stype: stype, dtype: :complex128))
609
704
  end
@@ -611,6 +706,7 @@ describe 'NMatrix' do
611
706
  [:object, :int64].each do |dtype|
612
707
  it "should work out-of-place for non-complex dtypes" do
613
708
  pending("not yet implemented for list stype") if stype == :list
709
+ pending("not yet implemented for Complex dtype for NMatrix-JRuby") if jruby?
614
710
  n = NMatrix.new([2,3], 1, stype: stype, dtype: dtype)
615
711
  expect(n.complex_conjugate).to eq(NMatrix.new([2,3], [1], stype: stype, dtype: dtype))
616
712
  end
@@ -677,7 +773,7 @@ describe 'NMatrix' do
677
773
 
678
774
  context "#diagonal" do
679
775
  ALL_DTYPES.each do |dtype|
680
- before do
776
+ before do
681
777
  @square_matrix = NMatrix.new([3,3], [
682
778
  23,11,23,
683
779
  44, 2, 0,
@@ -723,11 +819,14 @@ describe 'NMatrix' do
723
819
  end
724
820
 
725
821
  it "returns repeated matrix" do
822
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
726
823
  expect(@sample_matrix.repeat(2, 0)).to eq(NMatrix.new([4, 2], [1, 2, 3, 4, 1, 2, 3, 4]))
727
824
  expect(@sample_matrix.repeat(2, 1)).to eq(NMatrix.new([2, 4], [1, 2, 1, 2, 3, 4, 3, 4]))
728
825
  end
729
826
 
730
827
  it "preserves dtype" do
828
+ # FIXME
829
+ pending("not yet implemented for NMatrix-JRuby") if jruby?
731
830
  expect(@sample_matrix.repeat(2, 0).dtype).to eq(@sample_matrix.dtype)
732
831
  expect(@sample_matrix.repeat(2, 1).dtype).to eq(@sample_matrix.dtype)
733
832
  end
@@ -742,42 +841,50 @@ describe 'NMatrix' do
742
841
  @expected_for_ij = [NMatrix.new([3, 2], [1, 1, 2, 2, 3, 3]), NMatrix.new([3, 2], [4, 5, 4, 5, 4, 5])]
743
842
  @expected_for_sparse = [NMatrix.new([1, 3], [1, 2, 3]), NMatrix.new([2, 1], [4, 5])]
744
843
  @expected_for_sparse_ij = [NMatrix.new([3, 1], [1, 2, 3]), NMatrix.new([1, 2], [4, 5])]
844
+ # FIXME
745
845
  @expected_3dim = [NMatrix.new([1, 3, 1], [1, 2, 3]).repeat(2, 0).repeat(2, 2),
746
846
  NMatrix.new([2, 1, 1], [4, 5]).repeat(3, 1).repeat(2, 2),
747
- NMatrix.new([1, 1, 2], [6, 7]).repeat(2, 0).repeat(3, 1)]
847
+ NMatrix.new([1, 1, 2], [6, 7]).repeat(2, 0).repeat(3, 1)] unless jruby?
748
848
  @expected_3dim_sparse_ij = [NMatrix.new([3, 1, 1], [1, 2, 3]),
749
849
  NMatrix.new([1, 2, 1], [4, 5]),
750
850
  NMatrix.new([1, 1, 2], [6, 7])]
751
851
  end
752
852
 
753
853
  it "checks arrays count" do
854
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
754
855
  expect{NMatrix.meshgrid([@x])}.to raise_error(ArgumentError)
755
856
  expect{NMatrix.meshgrid([])}.to raise_error(ArgumentError)
756
857
  end
757
858
 
758
859
  it "flattens input arrays before use" do
860
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
759
861
  expect(NMatrix.meshgrid([@two_dim, @two_dim_array])).to eq(NMatrix.meshgrid([@two_dim.to_flat_array, @two_dim_array.flatten]))
760
862
  end
761
863
 
762
864
  it "returns new NMatrixes" do
865
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
763
866
  expect(NMatrix.meshgrid([@x, @y])).to eq(@expected_result)
764
867
  end
765
868
 
766
869
  it "has option :sparse" do
870
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
767
871
  expect(NMatrix.meshgrid([@x, @y], sparse: true)).to eq(@expected_for_sparse)
768
872
  end
769
873
 
770
874
  it "has option :indexing" do
875
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
771
876
  expect(NMatrix.meshgrid([@x, @y], indexing: :ij)).to eq(@expected_for_ij)
772
877
  expect(NMatrix.meshgrid([@x, @y], indexing: :xy)).to eq(@expected_result)
773
878
  expect{NMatrix.meshgrid([@x, @y], indexing: :not_ij_not_xy)}.to raise_error(ArgumentError)
774
879
  end
775
880
 
776
881
  it "works well with both options set" do
882
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
777
883
  expect(NMatrix.meshgrid([@x, @y], sparse: true, indexing: :ij)).to eq(@expected_for_sparse_ij)
778
884
  end
779
885
 
780
886
  it "is able to take more than two arrays as arguments and works well with options" do
887
+ pending("Not yet implemented for NMatrix JRuby") if jruby?
781
888
  expect(NMatrix.meshgrid([@x, @y, @z])).to eq(@expected_3dim)
782
889
  expect(NMatrix.meshgrid([@x, @y, @z], sparse: true, indexing: :ij)).to eq(@expected_3dim_sparse_ij)
783
890
  end
@@ -35,6 +35,7 @@ describe "NMatrix enumeration for" do
35
35
 
36
36
  if stype == :yale
37
37
  it "should iterate properly along each row of a slice" do
38
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
38
39
  vv = []
39
40
  ii = []
40
41
  jj = []
@@ -53,6 +54,7 @@ describe "NMatrix enumeration for" do
53
54
  end
54
55
 
55
56
  it "should iterate along diagonal portion of A array" do
57
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
56
58
  vv = []
57
59
  ii = []
58
60
  jj = []
@@ -67,6 +69,7 @@ describe "NMatrix enumeration for" do
67
69
  end
68
70
 
69
71
  it "should iterate along non-diagonal portion of A array" do
72
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
70
73
  vv = []
71
74
  ii = []
72
75
  jj = []
@@ -82,6 +85,7 @@ describe "NMatrix enumeration for" do
82
85
  end
83
86
 
84
87
  it "should iterate along a sliced diagonal portion of an A array" do
88
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
85
89
  m = n[0..3,1..3]
86
90
  vv = []
87
91
  ii = []
@@ -97,6 +101,7 @@ describe "NMatrix enumeration for" do
97
101
  end
98
102
 
99
103
  it "should iterate along a sliced non-diagonal portion of a sliced A array" do
104
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
100
105
  vv = []
101
106
  ii = []
102
107
  jj = []
@@ -114,6 +119,7 @@ describe "NMatrix enumeration for" do
114
119
  end
115
120
 
116
121
  it "should visit each stored element of the matrix in order by indices" do
122
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
117
123
  vv = []
118
124
  ii = []
119
125
  jj = []
@@ -129,7 +135,7 @@ describe "NMatrix enumeration for" do
129
135
  end
130
136
 
131
137
  it "should visit each stored element of the slice in order by indices" do
132
-
138
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
133
139
  vv = []
134
140
  ii = []
135
141
  jj = []
@@ -44,6 +44,8 @@ describe "Slice operation" do
44
44
 
45
45
  if stype == :yale
46
46
  it "should binary search for the left boundary of a partial row of stored indices correctly" do
47
+ #FIXME
48
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
47
49
  n = NMatrix.new(10, stype: :yale, dtype: :int32)
48
50
  n[3,0] = 1
49
51
  #n[3,2] = 2
@@ -87,7 +89,8 @@ describe "Slice operation" do
87
89
 
88
90
  unless stype == :dense
89
91
  it "should iterate across a row of stored indices" do
90
-
92
+ #FIXME
93
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
91
94
  vs = []
92
95
  is = []
93
96
  js = []
@@ -102,6 +105,8 @@ describe "Slice operation" do
102
105
  end
103
106
 
104
107
  it "should iterate across a submatrix of stored indices" do
108
+ #FIXME
109
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
105
110
  vs = []
106
111
  is = []
107
112
  js = []
@@ -118,6 +123,7 @@ describe "Slice operation" do
118
123
  end
119
124
 
120
125
  it "should return correct supershape" do
126
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
121
127
  x = NMatrix.random([10,12])
122
128
  y = x[0...8,5...12]
123
129
  expect(y.shape).to eq([8,7])
@@ -125,6 +131,7 @@ describe "Slice operation" do
125
131
  end
126
132
 
127
133
  it "should have #is_ref? method" do
134
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
128
135
  a = stype_matrix[0..1, 0..1]
129
136
  b = stype_matrix.slice(0..1, 0..1)
130
137
  expect(stype_matrix.is_ref?).to be false
@@ -145,6 +152,7 @@ describe "Slice operation" do
145
152
  end
146
153
 
147
154
  it 'should return a copy of 2x2 matrix to self elements' do
155
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
148
156
  n = stype_matrix.slice(1..2,0..1)
149
157
  expect(n.shape).to eql([2,2])
150
158
 
@@ -154,6 +162,8 @@ describe "Slice operation" do
154
162
  end
155
163
 
156
164
  it 'should return a 1x2 matrix without refs to self elements' do
165
+ #FIXME
166
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
157
167
  n = stype_matrix.slice(0,1..2)
158
168
  expect(n.shape).to eql([1,2])
159
169
 
@@ -165,6 +175,7 @@ describe "Slice operation" do
165
175
  end
166
176
 
167
177
  it 'should return a 2x1 matrix without refs to self elements' do
178
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
168
179
  stype_matrix.extend NMatrix::YaleFunctions
169
180
 
170
181
  n = stype_matrix.slice(0..1,1)
@@ -218,6 +229,8 @@ describe "Slice operation" do
218
229
  end
219
230
 
220
231
  it 'should return a 2x2 matrix with refs to self elements' do
232
+ #FIXME
233
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby? # and :cast_type != :dense
221
234
  n = stype_matrix[1..2,0..1]
222
235
  expect(n.shape).to eql([2,2])
223
236
 
@@ -227,6 +240,8 @@ describe "Slice operation" do
227
240
  end
228
241
 
229
242
  it 'should return a 1x2 vector with refs to self elements' do
243
+ #FIXME
244
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby? # and :cast_type != :dense
230
245
  n = stype_matrix[0,1..2]
231
246
  expect(n.shape).to eql([1,2])
232
247
 
@@ -236,6 +251,7 @@ describe "Slice operation" do
236
251
  end
237
252
 
238
253
  it 'should return a 2x1 vector with refs to self elements' do
254
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
239
255
  n = stype_matrix[0..1,1]
240
256
  expect(n.shape).to eql([2,1])
241
257
 
@@ -320,6 +336,8 @@ describe "Slice operation" do
320
336
  end
321
337
 
322
338
  it "compares slices to scalars" do
339
+ #FIXME
340
+ pending("not yet implemented for sparse matrices for NMatrix-JRuby") if jruby?
323
341
  (stype_matrix[1, 0..2] > 2).each { |e| expect(e != 0).to be true }
324
342
  end
325
343