mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
trace working
This commit is contained in:
@@ -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| {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -26,6 +26,7 @@ pub struct VmpPMat {
|
||||
/// The ring degree of each [VecZnxDft].
|
||||
n: usize,
|
||||
|
||||
#[warn(dead_code)]
|
||||
backend: BACKEND,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user