mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Small optimization + more fixes
This commit is contained in:
@@ -150,7 +150,7 @@ impl Scratch {
|
||||
unsafe { &mut *(data as *mut [u8] as *mut Self) }
|
||||
}
|
||||
|
||||
pub fn zero(&mut self){
|
||||
pub fn zero(&mut self) {
|
||||
self.data.fill(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -660,7 +660,7 @@ mod tests {
|
||||
|
||||
(0..*digits).for_each(|di| {
|
||||
(0..a_cols).for_each(|col_i| {
|
||||
module.vec_znx_dft(digits - 1 - di, *digits, &mut a_dft, col_i, &a, col_i);
|
||||
module.vec_znx_dft(*digits, digits - 1 - di, &mut a_dft, col_i, &a, col_i);
|
||||
});
|
||||
|
||||
if di == 0 {
|
||||
|
||||
@@ -2,9 +2,7 @@ use std::marker::PhantomData;
|
||||
|
||||
use crate::ffi::vec_znx_dft;
|
||||
use crate::znx_base::ZnxInfos;
|
||||
use crate::{
|
||||
Backend, DataView, DataViewMut, FFT64, Module, VecZnxBig, ZnxSliceSize, ZnxView, alloc_aligned,
|
||||
};
|
||||
use crate::{Backend, DataView, DataViewMut, FFT64, Module, VecZnxBig, ZnxSliceSize, ZnxView, alloc_aligned};
|
||||
use std::fmt;
|
||||
|
||||
pub struct VecZnxDft<D, B: Backend> {
|
||||
@@ -62,11 +60,15 @@ impl<D: AsRef<[u8]>> ZnxView for VecZnxDft<D, FFT64> {
|
||||
type Scalar = f64;
|
||||
}
|
||||
|
||||
impl<D: AsMut<[u8]> + AsRef<[u8]>> VecZnxDft<D, FFT64>{
|
||||
pub fn set_size(&mut self, size: usize){
|
||||
impl<D: AsMut<[u8]> + AsRef<[u8]>> VecZnxDft<D, FFT64> {
|
||||
pub fn set_size(&mut self, size: usize) {
|
||||
assert!(size <= self.data.as_ref().len() / (self.n * self.cols()));
|
||||
self.size = size
|
||||
}
|
||||
|
||||
pub fn max_size(&mut self) -> usize {
|
||||
self.data.as_ref().len() / (self.n * self.cols)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn bytes_of_vec_znx_dft<B: Backend>(module: &Module<B>, cols: usize, size: usize) -> usize {
|
||||
|
||||
@@ -163,10 +163,10 @@ impl VecZnxDftOps<FFT64> for Module<FFT64> {
|
||||
|
||||
(0..min_steps).for_each(|j| {
|
||||
let limb: usize = offset + j * step;
|
||||
if limb < a_ref.size(){
|
||||
if limb < a_ref.size() {
|
||||
res_mut
|
||||
.at_mut(res_col, j)
|
||||
.copy_from_slice(a_ref.at(a_col, limb));
|
||||
.at_mut(res_col, j)
|
||||
.copy_from_slice(a_ref.at(a_col, limb));
|
||||
}
|
||||
});
|
||||
(min_steps..res_mut.size()).for_each(|j| {
|
||||
|
||||
Reference in New Issue
Block a user