Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
multiexp.hpp
Go to the documentation of this file.
1
12#ifndef MULTIEXP_HPP_
13#define MULTIEXP_HPP_
14
15#include <cstddef>
16#include <vector>
17
18namespace libff {
19
48
56template<typename T, typename FieldT, multi_exp_method Method>
57T multi_exp(typename std::vector<T>::const_iterator vec_start,
58 typename std::vector<T>::const_iterator vec_end,
59 typename std::vector<FieldT>::const_iterator scalar_start,
60 typename std::vector<FieldT>::const_iterator scalar_end,
61 const size_t chunks);
62
63
70template<typename T, typename FieldT, multi_exp_method Method>
71T multi_exp_with_mixed_addition(typename std::vector<T>::const_iterator vec_start,
72 typename std::vector<T>::const_iterator vec_end,
73 typename std::vector<FieldT>::const_iterator scalar_start,
74 typename std::vector<FieldT>::const_iterator scalar_end,
75 const size_t chunks);
76
81template <typename T>
82T inner_product(typename std::vector<T>::const_iterator a_start,
83 typename std::vector<T>::const_iterator a_end,
84 typename std::vector<T>::const_iterator b_start,
85 typename std::vector<T>::const_iterator b_end);
86
90template<typename T>
91using window_table = std::vector<std::vector<T> >;
92
96template<typename T>
97size_t get_exp_window_size(const size_t num_scalars);
98
102template<typename T>
103window_table<T> get_window_table(const size_t scalar_size,
104 const size_t window,
105 const T &g);
106
107template<typename T, typename FieldT>
108T windowed_exp(const size_t scalar_size,
109 const size_t window,
110 const window_table<T> &powers_of_g,
111 const FieldT &pow);
112
113template<typename T, typename FieldT>
114std::vector<T> batch_exp(const size_t scalar_size,
115 const size_t window,
116 const window_table<T> &table,
117 const std::vector<FieldT> &v);
118
119template<typename T, typename FieldT>
120std::vector<T> batch_exp_with_coeff(const size_t scalar_size,
121 const size_t window,
122 const window_table<T> &table,
123 const FieldT &coeff,
124 const std::vector<FieldT> &v);
125
126template<typename T>
127void batch_to_special(std::vector<T> &vec);
128
129} // libff
130
131#include <libff/algebra/scalar_multiplication/multiexp.tcc>
132
133#endif // MULTIEXP_HPP_
std::vector< T > batch_exp(const size_t scalar_size, const size_t window, const window_table< T > &table, const std::vector< FieldT > &v)
std::vector< T > batch_exp_with_coeff(const size_t scalar_size, const size_t window, const window_table< T > &table, const FieldT &coeff, const std::vector< FieldT > &v)
T multi_exp_with_mixed_addition(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)
size_t get_exp_window_size(const size_t num_scalars)
multi_exp_method
Definition multiexp.hpp:20
@ multi_exp_method_naive_plain
Definition multiexp.hpp:28
@ multi_exp_method_naive
Definition multiexp.hpp:27
@ multi_exp_method_BDLO12
Definition multiexp.hpp:46
@ multi_exp_method_bos_coster
Definition multiexp.hpp:36
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)
window_table< T > get_window_table(const size_t scalar_size, const size_t window, const T &g)
T windowed_exp(const size_t scalar_size, const size_t window, const window_table< T > &powers_of_g, const FieldT &pow)
T inner_product(typename std::vector< T >::const_iterator a_start, typename std::vector< T >::const_iterator a_end, typename std::vector< T >::const_iterator b_start, typename std::vector< T >::const_iterator b_end)
void batch_to_special(std::vector< T > &vec)
std::vector< std::vector< T > > window_table
Definition multiexp.hpp:91
#define T(meth, val, expected)