From b584d674e82d4e23a84df61459da275270c6df44 Mon Sep 17 00:00:00 2001 From: Tyler Burdsall Date: Wed, 26 Dec 2018 16:36:40 -0800 Subject: [PATCH 1/5] Modify boost functions with updated lcp lib --- src/boost_functions.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/boost_functions.cpp b/src/boost_functions.cpp index 0734517..0d088c3 100644 --- a/src/boost_functions.cpp +++ b/src/boost_functions.cpp @@ -86,8 +86,7 @@ const void parse_args(const generation_args &args) } else { - set range = lazy_cartesian_product::boost_generate_random_indices(args.sample_size, max_size); - generate_random_samples(range, args); + generate_random_samples(max_size, args); } exit(0); } @@ -99,7 +98,7 @@ const void parse_args(const generation_args &args) } } -const void generate_random_samples(const set &range, const generation_args &args) +const void generate_random_samples(const uint1024_t &max_size, const generation_args &args) { if (!args.display_json) { @@ -112,16 +111,16 @@ const void generate_random_samples(const set &range, const generatio { cout << "[\n"; } - set::const_iterator i = range.begin(); - while (i != range.end()) + const uint1024_t parsed_sample_size(args.sample_size); + lazycp::RandomIterator iter(parsed_sample_size, max_size - 1); + while (iter.has_next()) { - vector result = lazy_cartesian_product::boost_entry_at(args.pc.combinations, (*i).convert_to()); + vector result = lazy_cartesian_product::boost_entry_at(args.pc.combinations, iter.next().convert_to()); output_result(result, args, true); - if (args.display_json && i != range.end()) + if (args.display_json && iter.has_next()) { cout << ","; } - ++i; } if (args.display_json) { From d2b40de51c24721e924ca1f892fc292d0d723dd6 Mon Sep 17 00:00:00 2001 From: Tyler Burdsall Date: Wed, 26 Dec 2018 16:36:52 -0800 Subject: [PATCH 2/5] Modify combigen functions with updated lcp lib --- src/combigen.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/combigen.cpp b/src/combigen.cpp index 7dccfda..902553f 100644 --- a/src/combigen.cpp +++ b/src/combigen.cpp @@ -84,8 +84,7 @@ const void parse_args(const generation_args &args) } else { - set range = lazy_cartesian_product::generate_random_indices(n, max_size); - generate_random_samples(range, args); + generate_random_samples(max_size, args); } exit(0); } @@ -127,7 +126,7 @@ const void generate_all(const unsigned long long &max_size, const generation_arg } } -const void generate_random_samples(const set &range, const generation_args &args) +const void generate_random_samples(const unsigned long long &max_size, const generation_args &args) { if (!args.display_json) { @@ -140,16 +139,16 @@ const void generate_random_samples(const set &range, const g { cout << "[\n"; } - set::const_iterator i = range.begin(); - while (i != range.end()) + unsigned long long parsed_sample_size = stoull(args.sample_size); + lazycp::RandomIterator iter(parsed_sample_size, max_size - 1); + while (iter.has_next()) { - vector result = lazy_cartesian_product::entry_at(args.pc.combinations, *i); + vector result = lazy_cartesian_product::entry_at(args.pc.combinations, iter.next()); output_result(result, args, true); - if (args.display_json && i != range.end()) + if (args.display_json && iter.has_next()) { cout << ","; } - ++i; } if (args.display_json) { From ff8040a849226768d41a818174bb0c451d7f0601 Mon Sep 17 00:00:00 2001 From: Tyler Burdsall Date: Wed, 26 Dec 2018 16:37:07 -0800 Subject: [PATCH 3/5] Updated function definitions --- src/combigen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/combigen.h b/src/combigen.h index 1f8e294..a41a8b1 100644 --- a/src/combigen.h +++ b/src/combigen.h @@ -68,10 +68,10 @@ struct generation_args #ifdef USE_BOOST const void generate_all(const uint1024_t &max_size, const generation_args &args); -const void generate_random_samples(const set &range, const generation_args &args); +const void generate_random_samples(const uint1024_t &max_size, const generation_args &args); #else const void generate_all(const unsigned long long &max_size, const generation_args &args); -const void generate_random_samples(const set &range, const generation_args &args); +const void generate_random_samples(const unsigned long long &max_size, const generation_args &args); #endif const void generate_random_samples_performance_mode(const generation_args &args); const void generate_random_samples_memory_mode(const generation_args &args); From 127181a4f1d5c7903c9e6c6a6f632df6835caed4 Mon Sep 17 00:00:00 2001 From: Tyler Burdsall Date: Wed, 26 Dec 2018 16:37:30 -0800 Subject: [PATCH 4/5] Update to newest version --- src/lib/iamtheburd/lazy-cartesian-product | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/iamtheburd/lazy-cartesian-product b/src/lib/iamtheburd/lazy-cartesian-product index aabb7b1..3fa7a56 160000 --- a/src/lib/iamtheburd/lazy-cartesian-product +++ b/src/lib/iamtheburd/lazy-cartesian-product @@ -1 +1 @@ -Subproject commit aabb7b1a88e8279211e511d1a53324fc5cb925f9 +Subproject commit 3fa7a56069c9dcdb072d908ce05e03113caac406 From 0e4ac7b8f6f2564d5fc0ca3f6f038fe72fe10eeb Mon Sep 17 00:00:00 2001 From: Tyler Burdsall Date: Wed, 26 Dec 2018 16:37:51 -0800 Subject: [PATCH 5/5] Fix bug that wouldn't show headers --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index cd7dea2..55331fd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,8 +20,8 @@ #define MAIN #define COMBIGEN_MAJOR_VERSION 1 -#define COMBIGEN_MINOR_VERSION 3 -#define COMBIGEN_REVISION_VERSION 2 +#define COMBIGEN_MINOR_VERSION 4 +#define COMBIGEN_REVISION_VERSION 0 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #include "lib/win-getopt/getopt.h" @@ -101,12 +101,14 @@ int main(int argc, char* argv[]) break; case 'k': args_provided = true; + args.display_keys = true; break; case 'v': cout << "combigen - v" << COMBIGEN_MAJOR_VERSION << '.' << COMBIGEN_MINOR_VERSION << '.' << COMBIGEN_REVISION_VERSION << '\n'; exit(0); case 'p': args.perf_mode = true; + args_provided = true; break; default: display_help();