Added VecZnxBorrow

This commit is contained in:
Jean-Philippe Bossuat
2025-02-14 18:26:54 +01:00
parent 68e61dc0e3
commit 67d8fd31b7
12 changed files with 605 additions and 595 deletions

View File

@@ -1,4 +1,4 @@
use crate::{VecZnx, VmpPMat};
use crate::{VecZnx, VecZnxBorrow, VmpPMat};
pub trait Infos {
/// Returns the ring degree of the receiver.
@@ -46,6 +46,33 @@ impl Infos for VecZnx {
}
}
impl Infos for VecZnxBorrow {
/// Returns the base 2 logarithm of the [VecZnx] degree.
fn log_n(&self) -> usize {
(usize::BITS - (self.n - 1).leading_zeros()) as _
}
/// Returns the [VecZnx] degree.
fn n(&self) -> usize {
self.n
}
/// Returns the number of limbs of the [VecZnx].
fn limbs(&self) -> usize {
self.limbs
}
/// Returns the number of limbs of the [VecZnx].
fn cols(&self) -> usize {
self.limbs
}
/// Returns the number of limbs of the [VecZnx].
fn rows(&self) -> usize {
1
}
}
impl Infos for VmpPMat {
/// Returns the ring dimension of the [VmpPMat].
fn n(&self) -> usize {