diff --git a/.gitmodules b/.gitmodules index e1b4217..494fb39 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "code/aesctr"] path = aesctr url = https://github.com/dnbaker/aesctr -[submodule "code/robin-hood-hashing"] - path = robin-hood-hashing - url = https://github.com/martinus/robin-hood-hashing/ [submodule "code/alias_sampler"] path = alias_sampler url = https://github.com/dnbaker/alias_sampler @@ -43,3 +40,6 @@ [submodule "libkl"] path = libkl url = https://github.com/dnbaker/libkl +[submodule "unordered_dense"] + path = unordered_dense + url = https://github.com/martinus/unordered_dense diff --git a/include/minicore/clustering/centroid.h b/include/minicore/clustering/centroid.h index be225f0..b8a0ea5 100644 --- a/include/minicore/clustering/centroid.h +++ b/include/minicore/clustering/centroid.h @@ -1,7 +1,9 @@ #ifndef MINOCORE_CLUSTERING_CENTROID_H__ #define MINOCORE_CLUSTERING_CENTROID_H__ +#include "minicore/util/macros.h" #include "minicore/util/blaze_adaptor.h" #include "minicore/util/csc.h" +#include "minicore/util/macros.h" #include "minicore/dist.h" #include "minicore/optim/kmedian.h" diff --git a/include/minicore/clustering/mtx2cs.h b/include/minicore/clustering/mtx2cs.h index ebc0eec..c998c23 100644 --- a/include/minicore/clustering/mtx2cs.h +++ b/include/minicore/clustering/mtx2cs.h @@ -2,6 +2,7 @@ #include "minicore/utility.h" #include "minicore/optim.h" #include "minicore/dist/distance.h" +#include "minicore/dist/applicator.h" namespace minicore { diff --git a/include/minicore/optim/lsearch.h b/include/minicore/optim/lsearch.h index a40a516..664c4f0 100644 --- a/include/minicore/optim/lsearch.h +++ b/include/minicore/optim/lsearch.h @@ -27,7 +27,7 @@ struct ExhaustiveSearcher { blaze::SmallArray bestsol_; double current_cost_; const unsigned k_; - ExhaustiveSearcher(const MatType &mat, unsigned k): mat_(mat), bestsol_(k_), current_cost_(std::numeric_limits::max()), k_(k) {} + ExhaustiveSearcher(const MatType &mat, unsigned k): mat_(mat), bestsol_(k), current_cost_(std::numeric_limits::max()), k_(k) {} void run() { blaze::SmallArray csol(k_); const size_t nr = mat_.rows(); diff --git a/include/minicore/util/shared.h b/include/minicore/util/shared.h index 8f4ca7d..9961f5a 100644 --- a/include/minicore/util/shared.h +++ b/include/minicore/util/shared.h @@ -1,5 +1,5 @@ #pragma once -#include "robin-hood-hashing/src/include/robin_hood.h" +#include "unordered_dense/include/ankerl/unordered_dense.h" #include "thirdparty/kxsort.h" #include "thirdparty/pdqsort.h" #include "aesctr/wy.h" @@ -29,12 +29,12 @@ template class TD; // Debugging only namespace shared { -template , +template , typename KeyEqual = std::equal_to> -using flat_hash_map = robin_hood::unordered_flat_map; +using flat_hash_map = ankerl::unordered_dense::map; -template, typename E = std::equal_to> -using flat_hash_set = robin_hood::unordered_flat_set; +template, typename E = std::equal_to> +using flat_hash_set = ankerl::unordered_dense::set; using ssize_t = std::ptrdiff_t; diff --git a/robin-hood-hashing b/robin-hood-hashing deleted file mode 160000 index 1f1bfc7..0000000 --- a/robin-hood-hashing +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1f1bfc7e52712364e4e7bbae8e5dd38349d0ee0f diff --git a/setup.py b/setup.py index 3333355..f280abe 100644 --- a/setup.py +++ b/setup.py @@ -24,8 +24,8 @@ def main(): if not path.isfile("libsimdsampling/libsimdsampling.a"): print("Making libss.a") check_call(f"make libsimdsampling/libsimdsampling.a", shell=True) - if not path.isfile("libgomp.a"): - check_call(f"ln -s `{environ.get('CXX', 'g++')} --print-file-name=libgomp.a`", shell=True, executable="/bin/bash") + # if not path.isfile("libgomp.a"): + check_call(f"ls libgomp.a || ln -s `{environ.get('CXX', 'g++')} --print-file-name=libgomp.a`", shell=True, executable="/bin/bash") # from https://stackoverflow.com/questions/11013851/speeding-up-build-process-with-distutils # parallelizes extension compilation diff --git a/src/kzclustexp.cpp b/src/kzclustexp.cpp index 4369650..69ac47f 100644 --- a/src/kzclustexp.cpp +++ b/src/kzclustexp.cpp @@ -305,7 +305,7 @@ void print_header(std::ofstream &ofs, char **argv, unsigned nsamples, unsigned k } void usage(const char *ex) { - std::fprintf(stderr, "usage: %s [input file or ../data/dolphins.graph]\n" + std::fprintf(stderr, "usage: %s [input file or paper2020/dolphins.graph]\n" "-k\tset k [12]\n" "-z\tset z [1.]\n" "-c\tAppend coreset size. Default: {5, 10, 15, 20, 25, 50, 75, 100, 125, 250, 375, 500, 625, 1250, 1875, 2500, 3125, 3750} (if empty)\n" @@ -455,7 +455,7 @@ int main(int argc, char **argv) { if(output_prefix.empty()) output_prefix = std::to_string(seed); output_prefix += '.' + std::to_string(k) + '.'; - std::string input = argc == optind ? "../data/dolphins.graph": const_cast(argv[optind]); + std::string input = argc == optind ? "paper2020/dolphins.graph": const_cast(argv[optind]); std::srand(seed); std::fprintf(stderr, "Reading from file: %s\n", input.data()); std::vector coordinates; diff --git a/src/mtx2cs.cpp b/src/mtx2cs.cpp index 2a24ad4..8cbb2e2 100644 --- a/src/mtx2cs.cpp +++ b/src/mtx2cs.cpp @@ -34,7 +34,6 @@ void usage() { "-R: Use reverse multinomial KL divergence\n" "-j: Use multinomial Jensen-Shannon divergence\n" "-J: Use multinomial Jensen-Shannon metric (square root of JSD)\n" - "-P: Use probability squared L2 norm\n" "-Q: Use probability L2 norm\n" "-T: Use total variation distance\n" "-i: Use Itakura-Saito distance\n" diff --git a/src/tests/clustertest.cpp b/src/tests/clustertest.cpp index a5bea79..3a7cf7f 100644 --- a/src/tests/clustertest.cpp +++ b/src/tests/clustertest.cpp @@ -34,7 +34,7 @@ int metamain(int argc, char **argv) { std::cerr << "Parsed matrix of " << pointmat.rows() << " rows and " << pointmat.columns() << " columns, with k = " << k << " clusters\n"; - auto jsdapp = make_probdiv_applicator(pointmat, blz::SQRL2); + auto jsdapp = make_probdiv_applicator(pointmat, minicore::distance::SQRL2); std::cerr << "Made probdiv applicator\n"; auto clusterdata = clustering::perform_clustering< is_hard ? clustering::HARD: clustering::SOFT, clustering::EXTRINSIC>(jsdapp, k); diff --git a/unordered_dense b/unordered_dense new file mode 160000 index 0000000..fd9054a --- /dev/null +++ b/unordered_dense @@ -0,0 +1 @@ +Subproject commit fd9054a62aa42f0a8402af9f234e5ca4f33dcee7