mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
Support for bivariate convolution & normalization with offset (#126)
* Add bivariate-convolution * Add pair-wise convolution + tests + benches * Add take_cnv_pvec_[left/right] to Scratch & updated CHANGELOG.md * cross-base2k normalization with positive offset * clippy & fix CI doctest avx compile error * more streamlined bounds derivation for normalization * Working cross-base2k normalization with pos/neg offset * Update normalization API & tests * Add glwe tensoring test * Add relinearization + preliminary test * Fix GGLWEToGGSW key infos * Add (X,Y) convolution by const (1, Y) poly * Faster normalization test + add bench for cnv_by_const * Update changelog
This commit is contained in:
committed by
GitHub
parent
76424d0ab5
commit
4e90e08a71
35
poulpy-cpu-ref/benches/convolution.rs
Normal file
35
poulpy-cpu-ref/benches/convolution.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use poulpy_cpu_ref::FFT64Ref;
|
||||
use poulpy_hal::bench_suite::convolution::{
|
||||
bench_cnv_apply_dft, bench_cnv_by_const_apply, bench_cnv_pairwise_apply_dft, bench_cnv_prepare_left, bench_cnv_prepare_right,
|
||||
};
|
||||
|
||||
fn bench_cnv_prepare_left_cpu_ref_fft64(c: &mut Criterion) {
|
||||
bench_cnv_prepare_left::<FFT64Ref>(c, "cpu_ref::fft64");
|
||||
}
|
||||
|
||||
fn bench_cnv_prepare_right_cpu_ref_fft64(c: &mut Criterion) {
|
||||
bench_cnv_prepare_right::<FFT64Ref>(c, "cpu_ref::fft64");
|
||||
}
|
||||
|
||||
fn bench_bench_cnv_apply_dft_cpu_ref_fft64(c: &mut Criterion) {
|
||||
bench_cnv_apply_dft::<FFT64Ref>(c, "cpu_ref::fft64");
|
||||
}
|
||||
|
||||
fn bench_bench_bench_cnv_pairwise_apply_dft_cpu_ref_fft64(c: &mut Criterion) {
|
||||
bench_cnv_pairwise_apply_dft::<FFT64Ref>(c, "cpu_ref::fft64");
|
||||
}
|
||||
|
||||
fn bench_cnv_by_const_apply_cpu_ref_fft64(c: &mut Criterion) {
|
||||
bench_cnv_by_const_apply::<FFT64Ref>(c, "cpu_ref::fft64");
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benches,
|
||||
bench_cnv_prepare_left_cpu_ref_fft64,
|
||||
bench_cnv_prepare_right_cpu_ref_fft64,
|
||||
bench_bench_cnv_apply_dft_cpu_ref_fft64,
|
||||
bench_bench_bench_cnv_pairwise_apply_dft_cpu_ref_fft64,
|
||||
bench_cnv_by_const_apply_cpu_ref_fft64,
|
||||
);
|
||||
criterion_main!(benches);
|
||||
@@ -11,10 +11,7 @@ pub fn bench_fft_ref(c: &mut Criterion) {
|
||||
fn runner(m: usize) -> impl FnMut() {
|
||||
let mut values: Vec<f64> = vec![0f64; m << 1];
|
||||
let scale: f64 = 1.0f64 / (2 * m) as f64;
|
||||
values
|
||||
.iter_mut()
|
||||
.enumerate()
|
||||
.for_each(|(i, x)| *x = (i + 1) as f64 * scale);
|
||||
values.iter_mut().enumerate().for_each(|(i, x)| *x = (i + 1) as f64 * scale);
|
||||
let table: ReimFFTTable<f64> = ReimFFTTable::<f64>::new(m);
|
||||
move || {
|
||||
ReimFFTRef::reim_dft_execute(&table, &mut values);
|
||||
@@ -39,10 +36,7 @@ pub fn bench_ifft_ref(c: &mut Criterion) {
|
||||
fn runner(m: usize) -> impl FnMut() {
|
||||
let mut values: Vec<f64> = vec![0f64; m << 1];
|
||||
let scale: f64 = 1.0f64 / (2 * m) as f64;
|
||||
values
|
||||
.iter_mut()
|
||||
.enumerate()
|
||||
.for_each(|(i, x)| *x = (i + 1) as f64 * scale);
|
||||
values.iter_mut().enumerate().for_each(|(i, x)| *x = (i + 1) as f64 * scale);
|
||||
let table: ReimIFFTTable<f64> = ReimIFFTTable::<f64>::new(m);
|
||||
move || {
|
||||
ReimIFFTRef::reim_dft_execute(&table, &mut values);
|
||||
|
||||
@@ -5,7 +5,7 @@ use poulpy_hal::reference::vec_znx::{bench_vec_znx_add, bench_vec_znx_automorphi
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn bench_vec_znx_add_cpu_ref_fft64(c: &mut Criterion) {
|
||||
bench_vec_znx_add::<FFT64Ref>(c, "cpu_spqlios::fft64");
|
||||
bench_vec_znx_add::<FFT64Ref>(c, "cpu_ref::fft64");
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
||||
Reference in New Issue
Block a user