trace working

This commit is contained in:
Jean-Philippe Bossuat
2025-04-23 11:32:52 +02:00
parent 9695761ff1
commit 09981b78b5
11 changed files with 301 additions and 105 deletions

View File

@@ -63,7 +63,7 @@ impl Sampling for Module {
while dist_f64.abs() > bound {
dist_f64 = dist.sample(source)
}
*a += (dist_f64.round() as i64) << log_base2k_rem
*a += (dist_f64.round() as i64) << log_base2k_rem;
});
} else {
a.at_mut(a.cols() - 1).iter_mut().for_each(|a| {

View File

@@ -347,8 +347,11 @@ pub trait VecZnxOps {
/// c <- a - b.
fn vec_znx_sub(&self, c: &mut VecZnx, a: &VecZnx, b: &VecZnx);
/// b <- a - b.
fn vec_znx_sub_ab_inplace(&self, b: &mut VecZnx, a: &VecZnx);
/// b <- b - a.
fn vec_znx_sub_inplace(&self, b: &mut VecZnx, a: &VecZnx);
fn vec_znx_sub_ba_inplace(&self, b: &mut VecZnx, a: &VecZnx);
/// b <- -a.
fn vec_znx_negate(&self, b: &mut VecZnx, a: &VecZnx);
@@ -452,8 +455,8 @@ impl VecZnxOps for Module {
}
}
// b <- a + b
fn vec_znx_sub_inplace(&self, b: &mut VecZnx, a: &VecZnx) {
// b <- a - b
fn vec_znx_sub_ab_inplace(&self, b: &mut VecZnx, a: &VecZnx) {
unsafe {
vec_znx::vec_znx_sub(
self.ptr,
@@ -470,6 +473,24 @@ impl VecZnxOps for Module {
}
}
// b <- b - a
fn vec_znx_sub_ba_inplace(&self, b: &mut VecZnx, a: &VecZnx) {
unsafe {
vec_znx::vec_znx_sub(
self.ptr,
b.as_mut_ptr(),
b.cols() as u64,
b.n() as u64,
b.as_ptr(),
b.cols() as u64,
b.n() as u64,
a.as_ptr(),
a.cols() as u64,
a.n() as u64,
)
}
}
fn vec_znx_negate(&self, b: &mut VecZnx, a: &VecZnx) {
unsafe {
vec_znx::vec_znx_negate(

View File

@@ -26,6 +26,7 @@ pub struct VmpPMat {
/// The ring degree of each [VecZnxDft].
n: usize,
#[warn(dead_code)]
backend: BACKEND,
}