Printing plaintext polynomial coefficients vs message vector slots

Hello! To understand the canonical embedding and the scale and round procedures in CKKS encoding [CKKS17], I was trying to print the plaintext polynomial coefficients (in R = Z(X)/(X^N+1)), but could only print the message vector (in C^(N/2)).
Please refer to the following lines:

    CCParams<CryptoContextCKKSRNS> parameters;
    CryptoContext<DCRTPoly> cc = GenCryptoContext(parameters);

    vector<double> x1 = {-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0};;
    Plaintext pt1 = cc->MakeCKKSPackedPlaintext(x1);

    cout << "Plaintext pt1: " << endl << pt1 << endl;
    cout << "CKKS Packed Values" << endl << pt1->GetCKKSPackedValue() << endl;

and the output is:

Plaintext pt1: 
(-4, -3, -2, -1, 0, 1, 2, 3, 4,  ... ); Estimated precision: 59 bits

CKKS Packed Values
[ (-4,0) (-3,0) (-2,0) (-1,0) (0,0) (1,0) (2,0) (3,0) (4,0) ]

You can print the plaintext as a DCRTPoly element as follows:

std::cout << "pt1 DCRTPoly: " << pt1 ->GetElement<DCRTPoly>() << std::endl;

1 Like