Load libraries that will be used.

Set a working seed for random numbers (so that random numbers can be replicated exactly).

Set some parameters.

Create the (complex) numbers we will encode.

Now we encode the vector of complex numbers to a polynomial.

Let’s view the result.

Let’s decode to obtain the original number:

The decoded z is indeed very close to the original z, we round the result to make the clearer.

Next, work through the CKKS-encode-2 vignette, which breaks down the encode and decode functions into the individual steps.