Ask Your Question
2

Polynomial ring modulus integer to univariate polynomial ring over the Integers

asked 2016-10-22 09:50:00 +0100

Node.js gravatar image

I want to use the DiscreteGaussianDistributionPolynomialSampler library:

from sage.stats.distributions.discrete_gaussian_polynomial import DiscreteGaussianDistributionPolynomialSampler
sage: DiscreteGaussianDistributionPolynomialSampler(ZZ['x'], 8, 3.0)()
3*x^7 + 3*x^6 - 3*x^5 - x^4 - 5*x^2 + 3

DiscreteGaussianDistributionPolynomialSampler(P, n, sigma)
P - a univariate polynomial ring over the Integers
n - number of coefficients to be sampled
sigma -

However, it takes a univariate polynomial ring over the Integers but I want to use a quotient ring of integers modulus instead. Something like this:

Quotient polynomial ring of: (x^1024 + 1) modulus 13:

modulus = 13
R = PolynomialRing(GF(modulus), "X")
X = R.gen()
Y = R.quotient(X^1024 + 1, "x")
x = Y.gen()

Question: Is it possible? if it is not possible is there a way to manually mod the result with x^1024 +1 and then with 13 afterwards?

Any help would be appreciated.

edit retag flag offensive close merge delete

Comments

Link of the library (I didn't have sufficient points to have URL in my question): http://doc.sagemath.org/html/en/reference/stats/sage/stats/distributions/discrete_gaussian_polynomial.html#sage.stats.distributions.discrete_gaussian_polynomial.DiscreteGaussianDistributionPolynomialSampler.__init__ (link)

Node.js gravatar imageNode.js ( 2016-10-22 09:51:01 +0100 )edit
slelievre gravatar imageslelievre ( 2016-12-03 15:42:54 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-10-27 14:23:50 +0100

castor gravatar image

Your code is almost there, probably you need the following:

from sage.stats.distributions.discrete_gaussian_polynomial import DiscreteGaussianDistributionPolynomialSampler
f=DiscreteGaussianDistributionPolynomialSampler(ZZ['x'], 8, 3.0)()
R.<X> = PolynomialRing(GF(13))
Y.<t> = R.quotient(X^1024 + 1)
Y(f)

Here you obtain

10*t^7 + 5*t^6 + 3*t^4 + 7*t^3 + 12*t^2 + 2*t + 1
edit flag offensive delete link more
1

answered 2019-06-08 16:34:46 +0100

slelievre gravatar image

It seems DiscreteGaussianDistributionPolynomialSampler is flexible enough to accept the quotient ring in the question instead of a polynomial ring over the integers.

So one could do directly:

sage: from sage.stats.distributions.discrete_gaussian_polynomial import DiscreteGaussianDistributionPolynomialSampler

sage: R.<X> = PolynomialRing(GF(13))
sage: Y.<x> = R.quotient(X^1024 + 1)
sage: Y
Univariate Quotient Polynomial Ring in x over Finite Field of size 13 with modulus X^1024 + 1

sage: Q = DiscreteGaussianDistributionPolynomialSampler(Y, 8, 3.0)()
sage: Q
2*x^6 + 10*x^5 + 2*x^4 + 5*x^3 + 9*x + 7
sage: Q.parent()
Univariate Quotient Polynomial Ring in x over Finite Field of size 13 with modulus X^1024 + 1

Or, having started with ZZ['x'], one could convert to Y afterwards as in @castor's answer.

sage: P = DiscreteGaussianDistributionPolynomialSampler(ZZ['x'], 8, 3.0)()
sage: Q = Y(P)

sage: P
-6*x^7 - x^6 - 2*x^5 - 3*x^4 - 3*x^3 + 3*x + 2
sage: Q
7*x^7 + 12*x^6 + 11*x^5 + 10*x^4 + 10*x^3 + 3*x + 2

sage: P.parent()
Univariate Polynomial Ring in x over Integer Ring
sage: Q.parent()
Univariate Quotient Polynomial Ring in x over Finite Field of size 13 with modulus X^1024 + 1

sage: Q = DiscreteGaussianDistributionPolynomialSampler(Y, 8, 3.0)()
sage: Q
2*x^6 + 10*x^5 + 2*x^4 + 5*x^3 + 9*x + 7
sage: Q.parent()
Univariate Quotient Polynomial Ring in x over Finite Field of size 13 with modulus X^1024 + 1
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-10-22 09:50:00 +0100

Seen: 1,297 times

Last updated: Jun 08 '19