1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use crate::client::Client;
use crate::fft::discrete_fourier_transform;
use crate::field::FieldElement;
use crate::pcp::gadgets::Mul;
use crate::pcp::PcpError;
use crate::polynomial::{poly_fft, PolyAuxMemory};
pub fn benchmarked_iterative_fft<F: FieldElement>(outp: &mut [F], inp: &[F]) {
discrete_fourier_transform(outp, inp, inp.len()).unwrap();
}
pub fn benchmarked_recursive_fft<F: FieldElement>(outp: &mut [F], inp: &[F]) {
let mut mem = PolyAuxMemory::new(inp.len() / 2);
poly_fft(
outp,
inp,
&mem.roots_2n,
inp.len(),
false,
&mut mem.fft_memory,
)
}
pub fn benchmarked_gadget_mul_call_poly_fft<F: FieldElement>(
g: &mut Mul<F>,
outp: &mut [F],
inp: &[Vec<F>],
) -> Result<(), PcpError> {
g.call_poly_fft(outp, inp)
}
pub fn benchmarked_gadget_mul_call_poly_direct<F: FieldElement>(
g: &mut Mul<F>,
outp: &mut [F],
inp: &[Vec<F>],
) -> Result<(), PcpError> {
g.call_poly_direct(outp, inp)
}
pub fn benchmarked_v2_prove<F: FieldElement>(data: &[F], client: &mut Client<F>) -> Vec<F> {
let copy_data = |share_data: &mut [F]| {
share_data[..].clone_from_slice(data);
};
client.prove_with(copy_data)
}