diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e7e284c3..7cad77544 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,8 @@ # create config.cc file that contains definitions of global variables (such as version, verbosity, etc.) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.cc.in" "${CMAKE_CURRENT_BINARY_DIR}/config.cc" @ONLY) + + add_library(libmata STATIC # add_library(libmata SHARED alphabet.cc diff --git a/src/nfa/delta.cc b/src/nfa/delta.cc index fce5711e0..fb6d73d78 100644 --- a/src/nfa/delta.cc +++ b/src/nfa/delta.cc @@ -557,19 +557,26 @@ OrdVector Delta::get_used_symbols() const { // return ov; ///WITH BOOL VECTOR, DIFFERENT VARIANT? (1.9s): - //std::vector bv = get_used_symbols_bv(); - //std::vector v(std::count(bv.begin(), bv.end(), true)); - //return utils::OrdVector(v); + // std::vector bv = get_used_symbols_bv(); + // utils::OrdVector ov{}; + // ov.reserve(static_cast(std::count(bv.begin(), bv.end(), true))); + // const size_t bv_size{ bv.size() }; + // for (Symbol i = 0; i < bv_size; i++) { + // if (bv[i]) { + // ov.push_back(i); + // } + // } + // return ov; //WITH CHAR VECTOR (should be the fastest, haven't tried in this branch): //BEWARE: failing in one noodlificatoin test ("Simple automata -- epsilon result") ... strange - //BoolVector chv = get_used_symbols_chv(); - //utils::OrdVector ov; - //for(Symbol i = 0;i ov; + // for(Symbol i = 0;i Delta::get_used_symbols_set() const { mata::utils::SparseSet Delta::get_used_symbols_sps() const { #ifdef _STATIC_STRUCTURES_ //static seems to speed things up a little - static utils::SparseSet symbols(64,false); + static utils::SparseSet symbols(64); symbols.clear(); #else utils::SparseSet symbols(64); @@ -644,7 +651,6 @@ std::vector Delta::get_used_symbols_bv() const { for (const StatePost& state_post: state_posts_) { for (const SymbolPost& symbol_post: state_post) { const size_t capacity{ symbol_post.symbol + 1 }; - reserve_on_insert(symbols, capacity); if (symbols.size() < capacity) { symbols.resize(capacity); } @@ -665,7 +671,10 @@ mata::BoolVector Delta::get_used_symbols_chv() const { //symbols.dont_track_elements(); for (const StatePost& state_post: state_posts_) { for (const SymbolPost& symbol_post: state_post) { - reserve_on_insert(symbols,symbol_post.symbol); + const size_t capacity{ symbol_post.symbol + 1 }; + if (symbols.size() < capacity) { + symbols.resize(capacity * 2); + } symbols[symbol_post.symbol] = true; } }