Exemplo n.º 1
0
 def test_gw_02(self):
     mtrx = csr_matrix(np.identity(6), dtype=int)
     r = Utils.delete_rows_csr(mtrx, [0, 1, 2])
     e = csr_matrix([[0, 0, 0, 1, 0, 0],
                     [0, 0, 0, 0, 1, 0],
                     [0, 0, 0, 0, 0, 1]])
     TestUtils.equal_csr_matrix(self, r, e, 'removed row csr_matrix')
Exemplo n.º 2
0
 def test_gw_01(self):
     mtrx = csr_matrix(np.identity(6), dtype=int)
     r = Utils.delete_rows_csr(mtrx, [1, 3])
     e = csr_matrix([[1, 0, 0, 0, 0, 0],
                     [0, 0, 1, 0, 0, 0],
                     [0, 0, 0, 0, 1, 0],
                     [0, 0, 0, 0, 0, 1]])
     TestUtils.equal_csr_matrix(self, r, e, 'removed row csr_matrix')
     orig = csr_matrix(np.identity(6), dtype=int)
     TestUtils.equal_csr_matrix(self, mtrx, orig, 'original csr_matrix')
Exemplo n.º 3
0
 def test_bw_01(self):
     mtrx = csr_matrix(np.identity(6), dtype=int)
     with self.assertRaisesRegex(AssertionError, 'out of bounds'):
         # Index out of bounds
         Utils.delete_rows_csr(mtrx, [7])
Exemplo n.º 4
0
 def test_gw_03(self):
     mtrx = csr_matrix(np.identity(6), dtype=int)
     r = Utils.delete_rows_csr(mtrx, range(6))
     e = (0, 6)
     TestUtils.equal_tuple_numbers(self, r.shape, e, 'shape of empty matrix')