CtxtCacheMem#
Currently, this API is unsupported in Python
-
class CtxtCacheMem : public helayers::circuit::CtxtCache#
This class is a special case of CtxtCache where the ciphertexts are all stored in the RAM.
Public Functions
-
inline CtxtCacheMem()#
-
void encrypt(const HeContext &henc)#
Encrypt all the plaintexts.
- Parameters:
henc – The context to encrypt with.
-
virtual bool hasById(const CtxtId &i) const override#
Return whether a ctxt given by ID is associated with this cache.
- Parameters:
id – The id of ctxt.
- Returns:
whether should be found in this cache.
-
inline virtual bool isReadyById(const CtxtId &i) const override#
Return whether a ctxt given by ID is currently ready in memory.
- Parameters:
id – The id of a ctxt.
- Returns:
Whether the ctxt is ready in memory.
-
virtual CTile &getById(const CtxtId &i) override#
Return the ctxt associated with an ID.
- Parameters:
id – The id of a ctxt.
- Returns:
The ctxt associated with the ID.
-
virtual const CTile &getById(const CtxtId &i) const override#
Return the ctxt associated with an ID.
- Parameters:
id – The id of a ctxt.
- Returns:
The ctxt associated with the ID.
-
virtual void merge(CtxtCache &c) override#
Merge the content of another cache into this cache.
Equal keys are assumed to hold equal values, values given to these keys are ignored.
- Parameters:
c – The cache to merge into this cache. After this function c is cleared.
-
virtual void setById(const CtxtId &i, const CTile &c) override#
Set a ctxt and associate it with an ID.
- Parameters:
id – The id of the ctxt.
- Throws:
runtime_error – if the cache is read-only, also if the id already exists in the cache.
-
virtual void setById(const CtxtId &i, CTile &&c) override#
Set a ctxt and associate it with an ID.
The function uses std::move which empties the input ctxt.
- Parameters:
id – The id of the ctxt.
- Throws:
runtime_error – if the cache is read-only, also if the id already exists in the cache.
-
void setById(const CtxtId &i, const RawValues &vals, int chainIndex)#
Add a CTile, given by its raw-values, to the cache.
Returns whether it was successfully added. A CTile may fail to be added if the cache is read-only or if the CTile is not associated with this cache.
-
virtual void retireById(const CtxtId &i) override#
Remove a ctxt from memory.
- Parameters:
id – The id of ctxt.
-
virtual bool hasByLabel(const CtxtLabel &i) const override#
Return whether a ctxt given by label is associated with this cache.
- Parameters:
label – The label of ctxt.
- Returns:
Whether the ctxt with this label is associated with this cache.
-
inline virtual bool isReadyByLabel(const CtxtLabel &i) const override#
Return whether a ctxt given by label is currently ready in memory.
- Parameters:
label – The label of the ctxt.
- Returns:
Whether the ctxt is ready in memory.
-
virtual CTile &getByLabel(const CtxtLabel &i) override#
Return the ctxt associated with a label.
- Parameters:
label – The label of the ctxt.
- Returns:
The ctxt associated with label.
-
virtual void setByLabel(const CtxtLabel &i, const CTile &c) override#
Set a CTile associated with a label.
-
void setByLabel(const CtxtLabel &label, const CTileTensor &c)#
Set a CTileTensor associated with a label.
This saves the shape and sets all the CTiles in the tensor.
-
virtual void translateLabelsToIds(const std::map<CtxtLabel, CtxtId> &map) override#
Remove a ctxt from memory.
Provide a map that translates labels to IDs.
- Parameters:
label – The label of the ctxt.
map – The map that translates labels to IDs.
-
virtual int getCTileNumber() const override#
Return how many ctxts the cache is associated with.
-
inline CtxtCacheMem()#