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')
def test_gw_04(self): mtrx = csr_matrix([[0, 1, 0], [1, 0, 1], [0, 1, 0]]) new_row = [-1, -1, -1] Utils.set_row_csr(mtrx, 2, new_row) e = csr_matrix([[0, 1, 0], [1, 0, 1], [-1, -1, -1]]) TestUtils.equal_csr_matrix(self, mtrx, e, 'new_csr')
def test_gw_03(self): mtrx = csr_matrix([[0, 1, 0], [1, 0, 1], [0, 1, 0]]) new_row = np.array([-1, -1, -1], dtype=float) Utils.set_row_csr(mtrx, 2, new_row) e = csr_matrix([[0, 1, 0], [1, 0, 1], [-1, -1, -1]]) TestUtils.equal_csr_matrix(self, mtrx, e, 'new_csr')
def test_gw_01(self): mtrx = csr_matrix([[0, 1, 0], [1, 0, 1], [0, 1, 0]]) new_row = np.array([2, 3, 4]) Utils.set_row_csr(mtrx, 0, new_row) e = csr_matrix([[2, 3, 4], [1, 0, 1], [0, 1, 0]]) TestUtils.equal_csr_matrix(self, mtrx, e, 'new_csr')
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')