diff --git a/makefiles/Makefile.gen.mk b/makefiles/Makefile.gen.mk index 6e0f7cedf4..32bc69498a 100644 --- a/makefiles/Makefile.gen.mk +++ b/makefiles/Makefile.gen.mk @@ -30,7 +30,6 @@ BASE_DEPS = \ $(SRC_DIR)/ortools/base/recordio.h \ $(SRC_DIR)/ortools/base/small_map.h \ $(SRC_DIR)/ortools/base/small_ordered_set.h \ - $(SRC_DIR)/ortools/base/sparsetable.h \ $(SRC_DIR)/ortools/base/status.h \ $(SRC_DIR)/ortools/base/statusor.h \ $(SRC_DIR)/ortools/base/stl_util.h \ @@ -3534,4 +3533,3 @@ $(GEN_DIR)/ortools/constraint_solver/solver_parameters.pb.h: \ $(OBJ_DIR)/constraint_solver/solver_parameters.pb.$O: \ $(GEN_DIR)/ortools/constraint_solver/solver_parameters.pb.cc | $(OBJ_DIR)/constraint_solver $(CCC) $(CFLAGS) -c $(GEN_PATH)$Sortools$Sconstraint_solver$Ssolver_parameters.pb.cc $(OBJ_OUT)$(OBJ_DIR)$Sconstraint_solver$Ssolver_parameters.pb.$O - diff --git a/ortools/base/BUILD b/ortools/base/BUILD index 9db4474962..2d744faf2e 100644 --- a/ortools/base/BUILD +++ b/ortools/base/BUILD @@ -255,16 +255,6 @@ cc_library( ], ) -cc_library( - name = "sparsetable", - hdrs = [ - "sparsetable.h", - ], - deps = [ - ":base", - ], -) - cc_library( name = "accurate_sum", hdrs = [ diff --git a/ortools/base/sparsetable.h b/ortools/base/sparsetable.h deleted file mode 100644 index 7caa34bb44..0000000000 --- a/ortools/base/sparsetable.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2010-2018 Google LLC -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef OR_TOOLS_BASE_SPARSETABLE_H_ -#define OR_TOOLS_BASE_SPARSETABLE_H_ - -#include -#include "ortools/base/logging.h" - -namespace operations_research { -// This class implements a simple block-based sparse std::vector. -template -class sparsetable { - public: - sparsetable() : size_(0) {} - - void resize(int new_size) { - CHECK_GE(new_size, 0); - size_ = new_size; - const int reduced_size = (size_ + kBlockSize - 1) / kBlockSize; - if (reduced_size != elements_.size()) { - elements_.resize(reduced_size); - masks_.resize(reduced_size, 0U); - } - } - - const T& get(int index) const { - DCHECK_GE(index, 0); - DCHECK_LT(index, size_); - DCHECK(test(index)); - return elements_[index / kBlockSize][index % kBlockSize]; - } - - void set(int index, const T& elem) { - const int offset = index / kBlockSize; - const int pos = index % kBlockSize; - if (elements_[offset].size() == 0) { - elements_[offset].resize(kBlockSize); - } - elements_[offset][index % kBlockSize] = elem; - masks_[offset] |= (1U << pos); - } - - bool test(int index) const { - const int offset = index / kBlockSize; - const int pos = index % kBlockSize; - return ((masks_[offset] & (1U << pos)) != 0); - } - - int size() const { return size_; } - - private: - static const int kBlockSize = 32; - - int size_; - std::vector > elements_; - std::vector masks_; -}; -} // namespace operations_research - -#endif // OR_TOOLS_BASE_SPARSETABLE_H_ diff --git a/ortools/graph/BUILD b/ortools/graph/BUILD index e90eca078e..e9b6d07123 100644 --- a/ortools/graph/BUILD +++ b/ortools/graph/BUILD @@ -81,7 +81,6 @@ cc_library( # "//ortools/base:int_type_indexed_bitmap", "//ortools/base:int_type_indexed_vector", "//ortools/base:recordio", - "//ortools/base:sparsetable", "//ortools/base:strings", # "//ortools/thread", # "//ortools/util/coding:prefixvarint",