Added size and memory layout to VecZnxBig, VecZnxDft and VmpPmat

This commit is contained in:
Jean-Philippe Bossuat
2025-04-25 09:19:47 +02:00
parent f0eaddb63e
commit 3bdddd3857
22 changed files with 195 additions and 119 deletions

View File

@@ -1,7 +1,7 @@
use crate::LAYOUT;
use crate::cast_mut;
use crate::ffi::vec_znx;
use crate::ffi::znx;
use crate::LAYOUT;
use crate::{Infos, Module};
use crate::{alloc_aligned, assert_alignement};
use itertools::izip;
@@ -99,11 +99,6 @@ impl VecZnx {
self.data.len() == 0
}
/// TODO: when SML refactoring is done, move this to the [Infos] trait.
pub fn size(&self) -> usize {
self.size
}
/// Total size is [VecZnx::n()] * [VecZnx::size()] * [VecZnx::cols()].
pub fn raw(&self) -> &[i64] {
unsafe { std::slice::from_raw_parts(self.ptr, self.n * self.size * self.cols) }
@@ -225,6 +220,14 @@ impl Infos for VecZnx {
self.n
}
fn size(&self) -> usize {
self.size
}
fn layout(&self) -> LAYOUT {
self.layout
}
/// Returns the number of cols of the [VecZnx].
fn cols(&self) -> usize {
self.cols