Should I use `LweCiphertext64` or `LweCiphertext`?

Types like LweCiphertext are private, and you have to rely on types like LweCiphertext64 (LweCiphertext64 in concrete_core::backends::core::entities - Rust) which can only be allocated through an engine, with no automatic destruction. Am I right? I wanted to use LweCiphertext64 directly but it’s private so I think I should not use it even though it works.

Should everything be done with an engine? Because I guess it uses dynamic allocation and I have to manually free everything. Is there another way with RAAI style and stack allocation?

Hi there! In concrete-core our aim is to support various hardware implementations, which involves interfacing ourselves with other languages (in particular C/C++). Objects may then be allocated, computed upon and dropped via a C++ dependency. This is why we chose to expose the engines with explicit freeing of the objects. So yes, the idea is for users to only use publicly exposed types, that have to be dropped manually. For pure Rust objects (which they all are at the moment), you may skip the destroy call but we don’t recommend it, to maintain a consistency with regards to other types (for example Cuda entities that will be introduced for GPU support in a further release).

but these structs returned from engine have nothing to call. For example LweBootstrapKey64 in concrete_core::backends::core::entities - Rust does not have ‘.bootstrap()’ method like LweBootstrapKey. How am I supposed to use the stuff allocated from CoreEngine?

The idea is that you can use all the engines traits implemented by CoreEngine: CoreEngine in concrete_core::backends::core::engines - Rust. For the bootstrap you’ll use discard_bootstrap_lwe_ciphertext.

why so many methods have discard in it? What does it mean?

The explanation in the Rust documentation is here: concrete_core::specification::engines - Rust

“Discarding operations take both their inputs and outputs as arguments (example: LweCiphertextDiscardingAdditionEngine). In those operations, the data originally available in the outputs is not used for the computation. They are usually the fastest ones.”