ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 29 Jul 2020 12:08:02 +0200Tensor product over polynomial ringshttps://ask.sagemath.org/question/52715/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.Mon, 27 Jul 2020 16:53:47 +0200https://ask.sagemath.org/question/52715/tensor-product-over-polynomial-rings/Comment by niranjan for <p>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 <code>R = Z[x]/[x^n+1]</code> where coefficients are modulo <code>q</code>.</p>
<p>I want to calculate tensor product of <code>m1_q = (ct0 + sk * ct1)</code>
and <code>m2_q = (ct2 + sk * ct3)</code> and scale it down by <code>(q/2)</code>.
Each element <code>ct0</code>, <code>ct1</code>, <code>ct2</code>, <code>ct3</code>, <code>sk</code>, <code>m1_q</code>
and <code>m2_q</code> are elements of <code>Rq</code>.</p>
<p>Just for <code>m1_q</code> and <code>m2_q</code>, it is working out well:
<code>(2/q)*(m1_q tensor_product m2_q)</code>.
How can I calculate it in terms of <code>ct*</code>?
I tried writing it as:</p>
<pre><code>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)
</code></pre>
<p>Then I converted <code>c0</code>, <code>c1</code>, <code>c2</code> and <code>m_out</code> into <code>Rq</code>.</p>
<p>Now I was testing:</p>
<pre><code>c0 + c1 * sk + c2 * sk^2 == m_out
</code></pre>
<p>But these are not matching. Appreciate your help.</p>
https://ask.sagemath.org/question/52715/tensor-product-over-polynomial-rings/?comment=52737#post-id-52737Thanks @slelievre for formatting.Wed, 29 Jul 2020 12:08:02 +0200https://ask.sagemath.org/question/52715/tensor-product-over-polynomial-rings/?comment=52737#post-id-52737