multiples fixes to base2k, including svp to take into account column interleaving

This commit is contained in:
Jean-Philippe Bossuat
2025-05-07 15:51:01 +02:00
parent 6ce525e5a1
commit 64874dbda8
12 changed files with 99 additions and 14 deletions

View File

@@ -98,24 +98,34 @@ impl<D: From<Vec<u8>>> ScalarZnx<D> {
pub type ScalarZnxOwned = ScalarZnx<Vec<u8>>;
pub(crate) fn bytes_of_scalar_znx<B: Backend>(module: &Module<B>, cols: usize) -> usize {
ScalarZnxOwned::bytes_of::<i64>(module.n(), cols)
}
pub trait ScalarZnxAlloc {
fn bytes_of_scalar(&self, cols: usize) -> usize;
fn new_scalar(&self, cols: usize) -> ScalarZnxOwned;
fn new_scalar_from_bytes(&self, cols: usize, bytes: Vec<u8>) -> ScalarZnxOwned;
fn bytes_of_scalar_znx(&self, cols: usize) -> usize;
fn new_scalar_znx(&self, cols: usize) -> ScalarZnxOwned;
fn new_scalar_znx_from_bytes(&self, cols: usize, bytes: Vec<u8>) -> ScalarZnxOwned;
}
impl<B: Backend> ScalarZnxAlloc for Module<B> {
fn bytes_of_scalar(&self, cols: usize) -> usize {
fn bytes_of_scalar_znx(&self, cols: usize) -> usize {
ScalarZnxOwned::bytes_of::<i64>(self.n(), cols)
}
fn new_scalar(&self, cols: usize) -> ScalarZnxOwned {
fn new_scalar_znx(&self, cols: usize) -> ScalarZnxOwned {
ScalarZnxOwned::new::<i64>(self.n(), cols)
}
fn new_scalar_from_bytes(&self, cols: usize, bytes: Vec<u8>) -> ScalarZnxOwned {
fn new_scalar_znx_from_bytes(&self, cols: usize, bytes: Vec<u8>) -> ScalarZnxOwned {
ScalarZnxOwned::new_from_bytes::<i64>(self.n(), cols, bytes)
}
}
impl<D> ScalarZnx<D> {
pub(crate) fn from_data(data: D, n: usize, cols: usize) -> Self {
Self { data, n, cols }
}
}
pub trait ScalarZnxToRef {
fn to_ref(&self) -> ScalarZnx<&[u8]>;
}