concrete_boolean/engine/bootstrapping/
mod.rs1use crate::ciphertext::Ciphertext;
2use concrete_core::prelude::{LweCiphertext32, LweSize};
3mod cpu;
4#[cfg(feature = "cuda")]
5mod cuda;
6
7#[cfg(feature = "cuda")]
8pub(crate) use cuda::{CudaBootstrapKey, CudaBootstrapper};
9
10pub(crate) use cpu::{CpuBootstrapKey, CpuBootstrapper};
11
12pub trait BooleanServerKey {
13 fn lwe_size(&self) -> LweSize;
15}
16
17pub(crate) trait Bootstrapper: Default {
23 type ServerKey: BooleanServerKey;
24
25 fn bootstrap(
28 &mut self,
29 input: &LweCiphertext32,
30 server_key: &Self::ServerKey,
31 ) -> Result<LweCiphertext32, Box<dyn std::error::Error>>;
32
33 fn keyswitch(
36 &mut self,
37 input: &LweCiphertext32,
38 server_key: &Self::ServerKey,
39 ) -> Result<LweCiphertext32, Box<dyn std::error::Error>>;
40
41 fn bootstrap_keyswitch(
44 &mut self,
45 ciphertext: LweCiphertext32,
46 server_key: &Self::ServerKey,
47 ) -> Result<Ciphertext, Box<dyn std::error::Error>>;
48}