pub struct CudaUnsignedRadixCiphertext {
pub ciphertext: CudaRadixCiphertext,
}Available on crate features
integer and gpu only.Fields§
§ciphertext: CudaRadixCiphertextImplementations§
Source§impl CudaUnsignedRadixCiphertext
impl CudaUnsignedRadixCiphertext
pub fn new( d_blocks: CudaLweCiphertextList<u64>, info: CudaRadixCiphertextInfo, ) -> Self
Sourcepub fn from_radix_ciphertext(
radix: &RadixCiphertext,
streams: &CudaStreams,
) -> Self
pub fn from_radix_ciphertext( radix: &RadixCiphertext, streams: &CudaStreams, ) -> Self
Copies a RadixCiphertext to the GPU memory
§Example
use tfhe::core_crypto::gpu::vec::GpuIndex;
use tfhe::core_crypto::gpu::CudaStreams;
use tfhe::integer::gpu::ciphertext::CudaUnsignedRadixCiphertext;
use tfhe::integer::gpu::gen_keys_radix_gpu;
use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64;
let size = 4;
let gpu_index = 0;
let mut streams = CudaStreams::new_single_gpu(GpuIndex(gpu_index));
// Generate the client key and the server key:
let (cks, sks) = gen_keys_radix_gpu(
PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64,
size,
&mut streams,
);
let clear: u64 = 255;
// Encrypt two messages
let ctxt = cks.encrypt(clear);
let mut d_ctxt = CudaUnsignedRadixCiphertext::from_radix_ciphertext(&ctxt, &mut streams);
let mut h_ctxt = d_ctxt.to_radix_ciphertext(&mut streams);
assert_eq!(h_ctxt, ctxt);pub fn copy_from_radix_ciphertext( &mut self, radix: &RadixCiphertext, streams: &CudaStreams, )
Sourcepub fn to_radix_ciphertext(&self, streams: &CudaStreams) -> RadixCiphertext
pub fn to_radix_ciphertext(&self, streams: &CudaStreams) -> RadixCiphertext
use tfhe::core_crypto::gpu::vec::GpuIndex;
use tfhe::core_crypto::gpu::CudaStreams;
use tfhe::integer::gpu::ciphertext::CudaUnsignedRadixCiphertext;
use tfhe::integer::gpu::gen_keys_radix_gpu;
use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64;
let gpu_index = 0;
let mut streams = CudaStreams::new_single_gpu(GpuIndex(gpu_index));
// Generate the client key and the server key:
let num_blocks = 4;
let (cks, sks) = gen_keys_radix_gpu(
PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64,
num_blocks,
&mut streams,
);
let msg1 = 10u32;
let ct1 = cks.encrypt(msg1);
// Copy to GPU
let d_ct1 = CudaUnsignedRadixCiphertext::from_radix_ciphertext(&ct1, &mut streams);
let ct2 = d_ct1.to_radix_ciphertext(&mut streams);
let msg2 = cks.decrypt(&ct2);
assert_eq!(msg1, msg2);Trait Implementations§
Source§impl AsMut<CudaUnsignedRadixCiphertext> for CudaBooleanBlock
impl AsMut<CudaUnsignedRadixCiphertext> for CudaBooleanBlock
Source§fn as_mut(&mut self) -> &mut CudaUnsignedRadixCiphertext
fn as_mut(&mut self) -> &mut CudaUnsignedRadixCiphertext
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl AsRef<CudaUnsignedRadixCiphertext> for CudaBooleanBlock
impl AsRef<CudaUnsignedRadixCiphertext> for CudaBooleanBlock
Source§fn as_ref(&self) -> &CudaUnsignedRadixCiphertext
fn as_ref(&self) -> &CudaUnsignedRadixCiphertext
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl CudaCompressible for CudaUnsignedRadixCiphertext
impl CudaCompressible for CudaUnsignedRadixCiphertext
fn compress_into( self, messages: &mut Vec<CudaRadixCiphertext>, streams: &CudaStreams, ) -> DataKind
Source§impl CudaIntegerRadixCiphertext for CudaUnsignedRadixCiphertext
impl CudaIntegerRadixCiphertext for CudaUnsignedRadixCiphertext
const IS_SIGNED: bool = false
fn as_ref(&self) -> &CudaRadixCiphertext
fn as_mut(&mut self) -> &mut CudaRadixCiphertext
fn from(ct: CudaRadixCiphertext) -> Self
fn into_inner(self) -> CudaRadixCiphertext
fn duplicate(&self, streams: &CudaStreams) -> Self
Source§unsafe fn duplicate_async(&self, streams: &CudaStreams) -> Self
unsafe fn duplicate_async(&self, streams: &CudaStreams) -> Self
Safety Read more
fn block_carries_are_empty(&self) -> bool
fn holds_boolean_value(&self) -> bool
fn is_equal(&self, other: &Self, streams: &CudaStreams) -> bool
Auto Trait Implementations§
impl Freeze for CudaUnsignedRadixCiphertext
impl RefUnwindSafe for CudaUnsignedRadixCiphertext
impl Send for CudaUnsignedRadixCiphertext
impl Sync for CudaUnsignedRadixCiphertext
impl Unpin for CudaUnsignedRadixCiphertext
impl UnwindSafe for CudaUnsignedRadixCiphertext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CudaExpandable for Twhere
T: CudaIntegerRadixCiphertext,
impl<T> CudaExpandable for Twhere
T: CudaIntegerRadixCiphertext,
Source§fn from_expanded_blocks(
blocks: CudaRadixCiphertext,
kind: DataKind,
) -> Result<T, Error>
fn from_expanded_blocks( blocks: CudaRadixCiphertext, kind: DataKind, ) -> Result<T, Error>
Available on crate features
integer and gpu only.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more