# Tensor product over polynomial rings

I'm writing code for Fully Homomorphic Encryption multiplication routine. I'm trying to calculate tensor product over polynomial rings. Let's say I have elements in R = Z[x]/[x^n+1] where coefficients are modulo q.

I want to calculate tensor product of m1_q = (ct0 + sk * ct1) and m2_q = (ct2 + sk * ct3) and scale it down by (q/2). Each element ct0, ct1, ct2, ct3, sk, m1_q and m2_q are elements of Rq.

Just for m1_q and m2_q, it is working out well: (2/q)*(m1_q tensor_product m2_q). How can I calculate it in terms of ct*? I tried writing it as:

c0 = (2/q)*(ct0 tensor_product ct2)
c1 = (2/q)*( (ct0 tensor_product ct3) + (ct2 tensor_product ct1) )
c2 = (2/q)*(ct1 tensor_product ct3)
m_out = (2/q)*(m1_q tensor_product m2_q)


Then I converted c0, c1, c2 and m_out into Rq.

Now I was testing:

c0 + c1 * sk + c2 * sk^2 == m_out


But these are not matching. Appreciate your help.

edit retag close merge delete