mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 03:25:05 -05:00
chore(cpu): remove GgswLevelRow container
This commit is contained in:
@@ -394,7 +394,7 @@ unsafe fn update_with_fmadd_scalar(
|
||||
#[cfg_attr(__profiling, inline(never))]
|
||||
unsafe fn update_with_fmadd(
|
||||
output_fft_buffer: &mut [MaybeUninit<f64>],
|
||||
ggsw_row: GgswLevelRow<&[f64]>,
|
||||
ggsw_row: GlweCiphertext<&[f64]>,
|
||||
fourier: &[f64],
|
||||
is_output_uninit: bool,
|
||||
polynomial_size: usize,
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
use crate::implementation::{Container, ContainerMut, Split};
|
||||
|
||||
use super::{DecompParams, GlweParams};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[readonly::make]
|
||||
pub struct GgswLevelRow<C: Container> {
|
||||
pub data: C,
|
||||
pub glwe_params: GlweParams,
|
||||
pub decomposition_level: usize,
|
||||
}
|
||||
use super::{DecompParams, GlweCiphertext, GlweParams};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[readonly::make]
|
||||
pub struct GgswLevelMatrix<C: Container> {
|
||||
pub data: C,
|
||||
pub glwe_params: GlweParams,
|
||||
|
||||
pub decomposition_level: usize,
|
||||
}
|
||||
|
||||
@@ -27,60 +18,6 @@ pub struct GgswCiphertext<C: Container> {
|
||||
pub decomp_params: DecompParams,
|
||||
}
|
||||
|
||||
impl<C: Container> GgswLevelRow<C> {
|
||||
pub fn data_len(glwe_params: GlweParams) -> usize {
|
||||
glwe_params.polynomial_size * (glwe_params.dimension + 1)
|
||||
}
|
||||
|
||||
pub fn new(data: C, glwe_params: GlweParams, decomposition_level: usize) -> Self {
|
||||
debug_assert_eq!(data.len(), Self::data_len(glwe_params));
|
||||
Self {
|
||||
data,
|
||||
glwe_params,
|
||||
decomposition_level,
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn from_raw_parts(
|
||||
data: C::Pointer,
|
||||
glwe_params: GlweParams,
|
||||
decomposition_level: usize,
|
||||
) -> Self
|
||||
where
|
||||
C: Split,
|
||||
{
|
||||
let data = C::from_raw_parts(data, Self::data_len(glwe_params));
|
||||
Self {
|
||||
data,
|
||||
glwe_params,
|
||||
decomposition_level,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_view(&self) -> GgswLevelRow<&[C::Item]> {
|
||||
GgswLevelRow {
|
||||
data: self.data.as_ref(),
|
||||
glwe_params: self.glwe_params,
|
||||
decomposition_level: self.decomposition_level,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_mut_view(&mut self) -> GgswLevelRow<&mut [C::Item]>
|
||||
where
|
||||
C: ContainerMut,
|
||||
{
|
||||
GgswLevelRow {
|
||||
data: self.data.as_mut(),
|
||||
glwe_params: self.glwe_params,
|
||||
decomposition_level: self.decomposition_level,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_data(self) -> C {
|
||||
self.data
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Container> GgswLevelMatrix<C> {
|
||||
pub fn data_len(glwe_params: GlweParams) -> usize {
|
||||
glwe_params.polynomial_size * (glwe_params.dimension + 1) * (glwe_params.dimension + 1)
|
||||
@@ -134,13 +71,13 @@ impl<C: Container> GgswLevelMatrix<C> {
|
||||
self.data
|
||||
}
|
||||
|
||||
pub fn into_rows_iter(self) -> impl DoubleEndedIterator<Item = GgswLevelRow<C>>
|
||||
pub fn into_rows_iter(self) -> impl DoubleEndedIterator<Item = GlweCiphertext<C>>
|
||||
where
|
||||
C: Split,
|
||||
{
|
||||
self.data
|
||||
.split_into(self.glwe_params.dimension + 1)
|
||||
.map(move |slice| GgswLevelRow::new(slice, self.glwe_params, self.decomposition_level))
|
||||
.map(move |slice| GlweCiphertext::new(slice, self.glwe_params))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user