sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 480 forks source link

AbsoluteOrder.random_element and PolynomialQuotientRing_integer.random_element #16556

Open malb opened 10 years ago

malb commented 10 years ago

This ticket implements sampling from absolute orders of number fields using a discrete Gaussian distribution.

sage: from sage.stats.distributions.discrete_gaussian_lattice import DiscreteGaussianLatticeSampler
sage: K = CyclotomicField(16)
sage: R = K.ring_of_integers()
sage: D = DiscreteGaussianLatticeSampler(R.basis_matrix(), 8)
sage: R.random_element()
-zeta16^7 - 2*zeta16^5 - zeta16^2 - zeta16 - 1

and from ZZ[x]/<f>:

sage: from sage.stats.distributions.discrete_gaussian_lattice import DiscreteGaussianLatticeSampler
sage: P.<x> = ZZ[]
sage: Q.<x> = P.quotient(x^8 + 1)
sage: D = DiscreteGaussianLatticeSampler(Q.basis_matrix(), 8)
sage: Q.random_element(D)
x^7 - 3*x^5 + 9*x^4 + 2*x^3 + 2*x^2 - 5*x - 3

Depends on #15915

Component: number fields

Keywords: sd59

Author: Martin Albrecht

Branch/Commit: u/malb/t16556_absolute_order_random_element @ 98eaabf

Issue created by migration from https://trac.sagemath.org/ticket/16556

malb commented 10 years ago

Last 10 new commits:

9ea5bc4documentation clean up
f15c339Merge branch 'develop' of trac.sagemath.org:sage into discrete_gaussian
fba8f61Merge branch 'develop' of trac.sagemath.org:sage into discrete_gaussian
6dcd131include stats dir
bf03fd7fixed doctest failures
8711050moved & renamed discrete gaussian samplers
7926faeadded Gaussian samplers for polynomials and lattices
6ace4d7pass polynomial ring explicitly to distributions over polynomial rings
a910589addressed comments at https://github.com/sagemath/sage/pull/18
9efaa2fAbsoluteOrder.random_element(distribution='gaussian')
malb commented 10 years ago

Branch: u/malb/trac_16556

malb commented 10 years ago

Changed dependencies from 15915 to #15915

malb commented 10 years ago

Commit: 9efaa2f

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

042530dadded doctest for plotting histograms
18279acfaster discrete gaussians over lattices if lattice is trivial
4681abecherry picked doctest fix from u/saraedum/ticket/15915
c0dbee5Merge branch 'u/malb/15915_discrete_gaussians' into random_element
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from 9efaa2f to c0dbee5

malb commented 10 years ago

Changed branch from u/malb/trac_16556 to u/malb/t16556_absolute_order_random_element

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

8fde676PolynomialQuotient_integer.random_element(distribution='gaussian'
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from c0dbee5 to 8fde676

malb commented 10 years ago

Description changed:

--- 
+++ 
@@ -1 +1,21 @@
 This ticket implements sampling from absolute orders of number fields using a discrete Gaussian distribution.
+
+```
+sage: from sage.stats.distributions.discrete_gaussian_lattice import DiscreteGaussianLatticeSampler
+sage: K = CyclotomicField(16)
+sage: R = K.ring_of_integers()
+sage: D = DiscreteGaussianLatticeSampler(R.basis_matrix(), 8)
+sage: R.random_element()
+-zeta16^7 - 2*zeta16^5 - zeta16^2 - zeta16 - 1
+```
+
+and from `ZZ[x]/<f>`:
+
+```
+sage: from sage.stats.distributions.discrete_gaussian_lattice import DiscreteGaussianLatticeSampler
+sage: P.<x> = ZZ[]
+sage: Q.<x> = P.quotient(x^8 + 1)
+sage: D = DiscreteGaussianLatticeSampler(Q.basis_matrix(), 8)
+sage: Q.random_element(D)
+x^7 - 3*x^5 + 9*x^4 + 2*x^3 + 2*x^2 - 5*x - 3
+```
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

98eaabfbe more permissing in parameter handling but throw error if can't candle
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 10 years ago

Changed commit from 8fde676 to 98eaabf

malb commented 10 years ago

New commits:

98eaabfbe more permissing in parameter handling but throw error if can't candle
fchapoton commented 9 years ago
comment:9

needs rebase, does not apply