Skip to content

Commit 729a0dd

Browse files
committed
Incorrect docstring formatting 📖
Let's just say I was slightly sleep deprived when I made the previous commits. ...
1 parent 5d3a177 commit 729a0dd

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

‎src/sage/stats/distributions/discrete_gaussian_lattice.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# -*- coding: utf-8 -*-
2-
r""" Discrete Gaussian Samplers over Lattices
2+
r"""
3+
Discrete Gaussian Samplers over Lattices
34
45
This file implements oracles which return samples from a lattice following a
56
discrete Gaussian distribution. That is, if `\sigma` is big enough relative to
67
the provided basis, then vectors are returned with a probability proportional
78
to `\exp(-|x - c|_2^2 / (2\sigma^2))`. More precisely lattice vectors in `x \in
89
\Lambda` are returned with probability:
910
10-
`\exp(-|x - c|_2^2 / (2\sigma^2)) / (\Sigma_{x \in \Lambda} \exp(-|x|_2^2 /
11-
(2\sigma^2)))`
11+
.. MATH::
12+
13+
`\frac{\exp(-|x - c|_2^2 / (2\sigma^2))}{\sum_{x \in \Lambda} \exp(-|x|_2^2 /
14+
(2\sigma^2))}`
1215
1316
AUTHORS:
1417
@@ -189,8 +192,8 @@ def compute_precision(precision, sigma):
189192

190193
def _normalisation_factor_zz(self, tau=None, prec=None):
191194
r"""
192-
This function returns an approximation of `\Sigma_{x \in B}
193-
\exp(-|x|_2^2 / (2\sigma²))`, i.e. the normalisation factor such that the sum
195+
This function returns an approximation of `\sum_{x \in B}
196+
\exp(-|x|_2^2 / (2\sigma^2))`, i.e. the normalization factor such that the sum
194197
over all probabilities is 1 for `B`, via Poisson summation.
195198
196199
@@ -270,7 +273,6 @@ def _normalisation_factor_zz(self, tau=None, prec=None):
270273
...
271274
NotImplementedError: lattice must be integral for now
272275
"""
273-
274276
# If σ > 1:
275277
# We use the Fourier transform g(t) of f(x) = exp(-k^2 / 2σ^2), but
276278
# taking the norm of vector t^2 as input, and with norm_factor factored.
@@ -350,7 +352,7 @@ def f_or_hat(x):
350352
@cached_method
351353
def _maximal_r(self):
352354
r"""
353-
This function computes the largest value `r > 0` such that `Σ - r²BBᵀ`
355+
This function computes the largest value `r > 0` such that `\Sigma - r^2BB^@`
354356
is positive definite.
355357
356358
This is equivalent to finding `\lambda_1(\Sigma / Q) = 1 / \lambda_n(Q
@@ -401,7 +403,7 @@ def _randomise(self, v):
401403

402404
def __init__(self, B, sigma=1, c=0, r=None, precision=None, sigma_basis=False):
403405
r"""
404-
Construct a discrete Gaussian sampler over the lattice `\LAmbda(B)`
406+
Construct a discrete Gaussian sampler over the lattice `\Lambda(B)`
405407
with parameter ``sigma`` and center `c`.
406408
407409
INPUT:
@@ -583,7 +585,7 @@ def _precompute_data(self):
583585
[0 1 0]
584586
[0 0 1]
585587
586-
.. note:
588+
.. NOTE::
587589
588590
Do not call this method directly, it is called automatically from
589591
:func:`DiscreteGaussianDistributionLatticeSampler.__init__`.
@@ -795,7 +797,7 @@ def _call_in_lattice(self):
795797
sage: norm(mean_L.n() - D.c()) < 0.25
796798
True
797799
798-
.. note::
800+
.. NOTE::
799801
800802
Do not call this method directly, call
801803
:func:`DiscreteGaussianDistributionLatticeSampler.__call__` instead.
@@ -815,7 +817,7 @@ def _call(self):
815817
sage: norm(mean_L.n() - D.c()) < 0.25
816818
True
817819
818-
.. note::
820+
.. NOTE::
819821
820822
Do not call this method directly, call
821823
:func:`DiscreteGaussianDistributionLatticeSampler.__call__` instead.
@@ -837,7 +839,7 @@ def _call(self):
837839

838840
def add_offline_samples(self, cnt=1):
839841
"""
840-
Precompute samples from `B^{-1}D_1` to be used in :meth:`_call_non_spherical`
842+
Precompute samples from `B^{-1}D_1` to be used in :meth:`_call_non_spherical`.
841843
842844
EXAMPLES::
843845
@@ -868,7 +870,7 @@ def _call_non_spherical(self):
868870
sage: norm(mean_L.n() - D.c()) < 0.25
869871
True
870872
871-
.. note::
873+
.. NOTE::
872874
873875
Do not call this method directly, call
874876
:func:`DiscreteGaussianDistributionLatticeSampler.__call__` instead.

0 commit comments

Comments
 (0)