This repository provides two sets of codes:
-
Implementation of faster trace (C++)
1-1) bench_unroll.cpp implementation of the unrolled trace
1-2) bench_seq.cpp implementation of the sequential trace (rotations-and-sums method)
-
Cost analysis in terms of # modular multiplications (python3)
-
Modified version of PALSIADE v1.9.2
-> added faster automorphism via simple permutation (
Permute
function in poly.h/cpp and DCRTPoly.h).
The faster automorphism is applied to both 1-1) and 1-2) to conduct fair comparison.
mkdir build && cd build && cmake .. && make
./bench_unroll [logN] [M] [h] [L] [ell] [Delta] [d] [T]
e.g.
./bench_unroll 14 14 7 3 2 35 4 11
./bench_seq [logN] [M] [L] [ell] [Delta] [d] [T]
e.g.
./bench_seq 14 14 3 2 35 4 11
log N: ring dimension
M: # iterations for rotations-and-sums
h: # unrolled-iterations
L: maximal level (# of RNS moduli for this level = L + 1)
ell: level to examine (# of RNS moduli for this level = \ell + 1 where \ell <= L)
Delta: scaling factor for the CKKS encoding
d: maximal number of digits for key-switching (an integer that divides L+1)
---> # of special moduli k = (L+1)/d
T: the number of experiments to perform
./init_resulting_directory.sh
cd ./cost_analysis
python3 run_plot_fig1_ell_vs_rate.py
-> choose 1 and press enter
Plots are saved in /tmp/result/no_last_digit_rate/
.
python3 run_plot_fig2_fig3_dominant.py
Plots are saved in /tmp/result/cost_plot/
and /tmp/result/breakdown/
.
python3 run_plot_fig4_storage_various_M.py
Plots are saved in /tmp/result/numkey/
.