mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
* Added compressed serialization for GLWECiphertext + Ciphertext decompression * Added compressed serialization for GGLWECiphertext & GLWESwitchingkey * generalized automorphism test * Removed ops on scalar_znx, replaced by as_vec_znx/as_vec_znx_mut and then call op on vec_znx * Added tests for automorphism key encryption * Added tensorkey compressed * added ggsw compressed
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
use crate::{
|
|
hal::{
|
|
layouts::{Backend, MatZnxOwned, Module},
|
|
oep::{MatZnxAllocBytesImpl, MatZnxAllocImpl, MatZnxFromBytesImpl},
|
|
},
|
|
implementation::cpu_spqlios::CPUAVX,
|
|
};
|
|
|
|
unsafe impl<B: Backend> MatZnxAllocImpl<B> for B
|
|
where
|
|
B: CPUAVX,
|
|
{
|
|
fn mat_znx_alloc_impl(module: &Module<B>, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> MatZnxOwned {
|
|
MatZnxOwned::alloc(module.n(), rows, cols_in, cols_out, size)
|
|
}
|
|
}
|
|
|
|
unsafe impl<B: Backend> MatZnxAllocBytesImpl<B> for B
|
|
where
|
|
B: CPUAVX,
|
|
{
|
|
fn mat_znx_alloc_bytes_impl(module: &Module<B>, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> usize {
|
|
MatZnxOwned::bytes_of(module.n(), rows, cols_in, cols_out, size)
|
|
}
|
|
}
|
|
|
|
unsafe impl<B: Backend> MatZnxFromBytesImpl<B> for B
|
|
where
|
|
B: CPUAVX,
|
|
{
|
|
fn mat_znx_from_bytes_impl(
|
|
module: &Module<B>,
|
|
rows: usize,
|
|
cols_in: usize,
|
|
cols_out: usize,
|
|
size: usize,
|
|
bytes: Vec<u8>,
|
|
) -> MatZnxOwned {
|
|
MatZnxOwned::from_bytes(module.n(), rows, cols_in, cols_out, size, bytes)
|
|
}
|
|
}
|