Exemple #1
0
 public void testsparseget() {
   SparseMatrixCCS A = new SparseMatrixLil("1 0; 5 7; 0 5").toCCS();
   assertEquals(0.0, A.get(0, 1));
   assertEquals(0.0, A.get(2, 0));
   assertEquals(1.0, A.get(0, 0));
   assertEquals(5.0, A.get(1, 0));
   assertEquals(7.0, A.get(1, 1));
   assertEquals(5.0, A.get(2, 1));
 }
Exemple #2
0
 public void testCCsGetNonZeros() {
   SparseMatrixLil A = spzeros(3, 3);
   A.append(1, 0, 5);
   A.append(0, 1, 7);
   A.append(0, 0, 11);
   SparseMatrixCCS B = A.toCCS();
   assertEquals(3, B.nonZeros());
   assertEquals(2, B.nonZeros(0));
   assertEquals(1, B.nonZeros(1));
   assertEquals(0, B.nonZeros(2));
 }