11template <
typename GroupT>
17template<
typename GroupT>
24 for (
size_t i = 0; i <
count; i++) {
25 GroupT x = GroupT::random_element();
27 for (
size_t j = 0;
j < size;
j++) {
28 result[i].push_back(x);
36template<
typename FieldT>
43 for (
size_t i = 0; i <
count; i++) {
44 for (
size_t j = 0;
j < size;
j++) {
52template<
typename GroupT,
typename FieldT, multi_exp_method Method>
59 std::vector<GroupT> answers;
60 for (
size_t i = 0; i < group_elements.size(); i++) {
62 group_elements[i].cbegin(), group_elements[i].cend(),
63 scalars[i].cbegin(), scalars[i].cend(),
72template<
typename GroupT,
typename FieldT>
76 size_t expn_end_naive,
79 for (
size_t expn = expn_start; expn <= expn_end_fast; expn++) {
80 printf(
"%ld", expn); fflush(stdout);
89 group_elements, scalars);
90 printf(
"\t%lld", result_bos_coster.first); fflush(stdout);
94 group_elements, scalars);
95 printf(
"\t%lld", result_djb.first); fflush(stdout);
97 if (compare_answers && (result_bos_coster.second != result_djb.second)) {
98 fprintf(stderr,
"Answers NOT MATCHING (bos coster != djb)\n");
101 if (expn <= expn_end_naive) {
104 group_elements, scalars);
105 printf(
"\t%lld", result_naive.first); fflush(stdout);
107 if (compare_answers && (result_bos_coster.second != result_naive.second)) {
108 fprintf(stderr,
"Answers NOT MATCHING (bos coster != naive)\n");
120 printf(
"Profiling BN128_G1\n");
124 printf(
"Profiling BN128_G2\n");
static void init_public_params()
std::pair< long long, std::vector< GroupT > > run_result_t
std::vector< std::vector< T > > test_instances_t
run_result_t< GroupT > profile_multiexp(test_instances_t< GroupT > group_elements, test_instances_t< FieldT > scalars)
void print_performance_csv(size_t expn_start, size_t expn_end_fast, size_t expn_end_naive, bool compare_answers)
test_instances_t< FieldT > generate_scalars(size_t count, size_t size)
test_instances_t< GroupT > generate_group_elements(size_t count, size_t size)
typename EC_ppT::Fp_type Fr
long long get_nsec_time()
T multi_exp(typename std::vector< T >::const_iterator vec_start, typename std::vector< T >::const_iterator vec_end, typename std::vector< FieldT >::const_iterator scalar_start, typename std::vector< FieldT >::const_iterator scalar_end, const size_t chunks)
FieldT SHA512_rng(const uint64_t idx)
void print_compilation_info()