18
18
19
19
EXAMPLES::
20
20
21
- sage: from sage.stats.all import DGL
21
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
22
22
sage: D = DGL(ZZ^10, 3.0)
23
23
sage: D(), D(), D() # random
24
24
((3, 0, -5, 0, -1, -3, 3, 3, -7, 2), (4, 0, 1, -2, -4, -4, 4, 0, 1, -4), (-3, 0, 4, 5, 0, 1, 3, 2, 0, -1))
@@ -120,7 +120,7 @@ class DiscreteGaussianDistributionLatticeSampler(SageObject):
120
120
121
121
EXAMPLES::
122
122
123
- sage: from sage.stats.all import DGL
123
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
124
124
sage: D = DGL(ZZ^10, 3.0); D
125
125
Discrete Gaussian sampler with Gaussian parameter σ = 3.00000000000000, c=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) over lattice with basis
126
126
<BLANKLINE>
@@ -138,7 +138,7 @@ class DiscreteGaussianDistributionLatticeSampler(SageObject):
138
138
139
139
We plot a histogram::
140
140
141
- sage: from sage.stats.all import DGL
141
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
142
142
sage: import warnings
143
143
sage: warnings.simplefilter('ignore', UserWarning)
144
144
sage: D = DGL(identity_matrix(2), 3.0)
@@ -167,7 +167,7 @@ def compute_precision(precision, sigma):
167
167
168
168
EXAMPLES::
169
169
170
- sage: from sage.stats.all import DGL
170
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
171
171
sage: DGL.compute_precision(100, RR(3))
172
172
100
173
173
sage: DGL.compute_precision(100, RealField(200)(3))
@@ -208,7 +208,7 @@ def _normalisation_factor_zz(self, tau=None, prec=None):
208
208
209
209
EXAMPLES::
210
210
211
- sage: from sage.stats.all import DGL
211
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
212
212
sage: n = 3; sigma = 1.0
213
213
sage: D = DGL(ZZ^n, sigma)
214
214
sage: f = D.f
@@ -349,7 +349,7 @@ def _maximal_r(self):
349
349
350
350
EXAMPLES::
351
351
352
- sage: from sage.stats.all import DGL
352
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
353
353
sage: n = 3
354
354
sage: Sigma = Matrix(ZZ, [[5, -2, 4], [-2, 10, -5], [4, -5, 5]])
355
355
sage: c = vector(ZZ, [7, 2, 5])
@@ -420,7 +420,7 @@ def __init__(self, B, sigma=1, c=0, r=None, precision=None, sigma_basis=False):
420
420
421
421
EXAMPLES::
422
422
423
- sage: from sage.stats.all import DGL
423
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
424
424
sage: n = 2; sigma = 3.0
425
425
sage: D = DGL(ZZ^n, sigma)
426
426
sage: f = D.f
@@ -485,7 +485,7 @@ def __init__(self, B, sigma=1, c=0, r=None, precision=None, sigma_basis=False):
485
485
486
486
We can also initialise with matrix-like objects:
487
487
488
- sage: from sage.stats.all import DGL
488
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
489
489
sage: qf = QuadraticForm(matrix(3, [2, 1, 1, 1, 2, 1, 1, 1, 2]))
490
490
sage: D = DGL(qf, 3.0); D # needs sage.symbolic
491
491
Discrete Gaussian sampler with Gaussian parameter σ = 3.00000000000000, c=(0, 0, 0) over lattice with basis
@@ -597,7 +597,7 @@ def __call__(self):
597
597
598
598
EXAMPLES::
599
599
600
- sage: from sage.stats.all import DGL
600
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
601
601
sage: D = DGL(ZZ^3, 3.0, c=(1,0,0))
602
602
sage: L = [D() for _ in range(2^12)]
603
603
sage: mean_L = sum(L) / len(L)
@@ -649,7 +649,7 @@ def sigma(self):
649
649
650
650
EXAMPLES::
651
651
652
- sage: from sage.stats.all import DGL
652
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
653
653
sage: D = DGL(ZZ^3, 3.0, c=(1,0,0))
654
654
sage: D.sigma
655
655
3.00000000000000
@@ -663,7 +663,7 @@ def sigma(self, sigma):
663
663
664
664
EXAMPLES::
665
665
666
- sage: from sage.stats.all import DGL
666
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
667
667
sage: D = DGL(ZZ^3, 3.0, c=(1,0,0))
668
668
sage: D.c = (2, 0, 0)
669
669
sage: D
@@ -684,7 +684,7 @@ def c(self):
684
684
685
685
EXAMPLES::
686
686
687
- sage: from sage.stats.all import DGL
687
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
688
688
sage: D = DGL(ZZ^3, 3.0, c=(1,0,0)); D
689
689
Discrete Gaussian sampler with Gaussian parameter σ = 3.00000000000000, c=(1, 0, 0) over lattice with basis
690
690
<BLANKLINE>
@@ -704,7 +704,7 @@ def c(self, c):
704
704
705
705
EXAMPLES::
706
706
707
- sage: from sage.stats.all import DGL
707
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
708
708
sage: D = DGL(ZZ^3, 3.0, c=(1,0,0))
709
709
sage: D.c = (2, 0, 0)
710
710
sage: D
@@ -739,7 +739,7 @@ def __repr__(self):
739
739
r"""
740
740
EXAMPLES::
741
741
742
- sage: from sage.stats.all import DGL
742
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
743
743
sage: D = DGL(ZZ^3, 3.0, c=(1,0,0)); D
744
744
Discrete Gaussian sampler with Gaussian parameter σ = 3.00000000000000, c=(1, 0, 0) over lattice with basis
745
745
<BLANKLINE>
@@ -770,7 +770,7 @@ def _call_in_lattice(self):
770
770
771
771
EXAMPLES::
772
772
773
- sage: from sage.stats.all import DGL
773
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
774
774
sage: D = DGL(ZZ^3, 3.0, c=(1,0,0))
775
775
sage: L = [D._call_in_lattice() for _ in range(2^12)]
776
776
sage: mean_L = sum(L) / len(L)
@@ -790,7 +790,7 @@ def _call(self):
790
790
791
791
EXAMPLES::
792
792
793
- sage: from sage.stats.all import DGL
793
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
794
794
sage: D = DGL(ZZ^3, 3.0, c=(1/2,0,0))
795
795
sage: L = [D._call() for _ in range(2^12)]
796
796
sage: mean_L = sum(L) / len(L)
@@ -822,7 +822,7 @@ def add_offline_samples(self, cnt=1):
822
822
823
823
EXAMPLES::
824
824
825
- sage: from sage.stats.all import DGL
825
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
826
826
sage: Sigma = Matrix([[5, -2, 4], [-2, 10, -5], [4, -5, 5]])
827
827
sage: D = DGL(ZZ^3, Sigma)
828
828
sage: assert not D.is_spherical
@@ -843,7 +843,7 @@ def _call_non_spherical(self):
843
843
844
844
EXAMPLES::
845
845
846
- sage: from sage.stats.all import DGL
846
+ sage: from sage.stats.distributions.discrete_gaussian_lattice import DGL
847
847
sage: Sigma = Matrix([[5, -2, 4], [-2, 10, -5], [4, -5, 5]])
848
848
sage: D = DGL(ZZ^3, Sigma, c=(1/2,0,0))
849
849
sage: L = [D._call_non_spherical() for _ in range(2^12)]
0 commit comments