def test_update_dense_to_sparse(self): t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_SPARSE) update = np.ones(UPDATE_SHAPE) t.update(UPDATE_SUBSLICE, update, None) print t.data.todense()
def test_create_sparse(self): t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_SPARSE) t._initialize() Assert.eq(t.data.shape, ARRAY_SIZE) Assert.eq(t.mask, None)
def test_update_sparse_to_sparse(self): t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_SPARSE) update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32) for i in range(UPDATE_SHAPE[0]): update[i,i] = 1 t.update(UPDATE_SUBSLICE, update, None) Assert.eq(sp.issparse(t.data), True) print t.data.todense()
def test_update_sparse_to_dense(self): t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_DENSE) update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32) for i in range(UPDATE_SHAPE[0]): update[i,i] = 1 t.update(UPDATE_SUBSLICE, update, None) print t.data print t.mask
def test_update_sparse_to_sparse(self): t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_SPARSE) update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32) for i in range(UPDATE_SHAPE[0]): update[i, i] = 1 t.update(UPDATE_SUBSLICE, update, None) Assert.eq(sp.issparse(t.data), True) print t.data.todense()
def test_update_sparse_to_dense(self): t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_DENSE) update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32) for i in range(UPDATE_SHAPE[0]): update[i, i] = 1 t.update(UPDATE_SUBSLICE, update, None) print t.data print t.mask
def test_create_dense(self): t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_DENSE) t._initialize() Assert.eq(t.mask.shape, ARRAY_SIZE)