mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
Crates io (#76)
* crates re-organisation * fixed typo in layout & added test for vmp_apply * updated dependencies
This commit is contained in:
committed by
GitHub
parent
dce4d82706
commit
a1de248567
42
poulpy-hal/src/api/svp_ppol.rs
Normal file
42
poulpy-hal/src/api/svp_ppol.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
use crate::layouts::{Backend, ScalarZnxToRef, SvpPPolOwned, SvpPPolToMut, SvpPPolToRef, VecZnxDftToMut, VecZnxDftToRef};
|
||||
|
||||
/// Allocates as [crate::layouts::SvpPPol].
|
||||
pub trait SvpPPolAlloc<B: Backend> {
|
||||
fn svp_ppol_alloc(&self, n: usize, cols: usize) -> SvpPPolOwned<B>;
|
||||
}
|
||||
|
||||
/// Returns the size in bytes to allocate a [crate::layouts::SvpPPol].
|
||||
pub trait SvpPPolAllocBytes {
|
||||
fn svp_ppol_alloc_bytes(&self, n: usize, cols: usize) -> usize;
|
||||
}
|
||||
|
||||
/// Consume a vector of bytes into a [crate::layouts::MatZnx].
|
||||
/// User must ensure that bytes is memory aligned and that it length is equal to [SvpPPolAllocBytes].
|
||||
pub trait SvpPPolFromBytes<B: Backend> {
|
||||
fn svp_ppol_from_bytes(&self, n: usize, cols: usize, bytes: Vec<u8>) -> SvpPPolOwned<B>;
|
||||
}
|
||||
|
||||
/// Prepare a [crate::layouts::ScalarZnx] into an [crate::layouts::SvpPPol].
|
||||
pub trait SvpPrepare<B: Backend> {
|
||||
fn svp_prepare<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
|
||||
where
|
||||
R: SvpPPolToMut<B>,
|
||||
A: ScalarZnxToRef;
|
||||
}
|
||||
|
||||
/// Apply a scalar-vector product between `a[a_col]` and `b[b_col]` and stores the result on `res[res_col]`.
|
||||
pub trait SvpApply<B: Backend> {
|
||||
fn svp_apply<R, A, C>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize, b: &C, b_col: usize)
|
||||
where
|
||||
R: VecZnxDftToMut<B>,
|
||||
A: SvpPPolToRef<B>,
|
||||
C: VecZnxDftToRef<B>;
|
||||
}
|
||||
|
||||
/// Apply a scalar-vector product between `res[res_col]` and `a[a_col]` and stores the result on `res[res_col]`.
|
||||
pub trait SvpApplyInplace<B: Backend> {
|
||||
fn svp_apply_inplace<R, A>(&self, res: &mut R, res_col: usize, a: &A, a_col: usize)
|
||||
where
|
||||
R: VecZnxDftToMut<B>,
|
||||
A: SvpPPolToRef<B>;
|
||||
}
|
||||
Reference in New Issue
Block a user