I want to iterate through the individual coefficients of a plaintext in its RNS form and be able to modify them at will. Basically I’m studying the impact of a bit flip in different stages of a FHE pipeline.
This can be done in a easy way? Or my choice is to overload the operator for example?
Given an vector of double (input) I can encode it and see the coefficients but can’t change them.
Plaintext ptxt1 = cc->MakeCKKSPackedPlaintext(x1);
auto plainElem = ptxt1->GetElement<DCRTPoly>().GetAllElements();
for (size_t i = 0; i < plainElem.size(); i++)
std::cout << plainElem[i] << std::endl;
I’m sorry about the basic question about using your library.
Thank you!
ptxt1->GetElement<DCRTPoly>() can be modified directly just like any DCRTPoly. You can introduce a variable by reference to ptxt1->GetElement<DCRTPoly>() and work with it as a DCRTPoly. You can look up the API for DCRTPoly at Template Class DCRTPolyImpl — OpenFHE documentation