From 6897766dc46e47d60d31267a263168ebcf0a70c8 Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Tue, 1 Apr 2025 00:18:24 -0600 Subject: [PATCH 1/2] improve diamond_cutting documentation --- src/doc/en/reference/references/index.rst | 6 ++++++ src/sage/modules/diamond_cutting.py | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 1c6d4534559..f7449924da2 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -2757,6 +2757,12 @@ REFERENCES: Kirillov-Reshetikhin crystals for nonexceptional types*. Contemp. Math. 506 (2010) 127-143 ( :arxiv:`0811.1604` ) +.. [FP1985] U. Fincke and M. Pohst. + *Improved Methods for Calculating Vectors of Short Length in a + Lattice, Including a Complexity Analysis*. + Mathematics of Computation, 44 (1985), no. 1, 463-471. + :doi:`10.1090/S0025-5718-1985-0777278-8` + .. [FP1996] Komei Fukuda, Alain Prodon: Double Description Method Revisited, Combinatorics and Computer Science, volume 1120 of Lecture Notes in Computer Science, page diff --git a/src/sage/modules/diamond_cutting.py b/src/sage/modules/diamond_cutting.py index f470c7f72eb..679eb36f166 100644 --- a/src/sage/modules/diamond_cutting.py +++ b/src/sage/modules/diamond_cutting.py @@ -59,15 +59,15 @@ def jacobi(M): q_{i,j} = \begin{cases} \frac{1}{q_{i,i}} \left( m_{i,j} - \sum_{r j, \end{cases} for all `1 \leq i \leq n` and `1 \leq j \leq n`. (These equalities determine the entries of `Q` uniquely by - recursion.) This matrix `Q` is defined for all `M` in a - certain Zariski-dense open subset of the set of all - `n \times n`-matrices. + recursion.) This matrix `Q` is defined for every invertible + `n \times n`-matrix `M`. Its definition is taken from (2.3) + of [FP1985]_. .. NOTE:: @@ -135,7 +135,7 @@ def diamond_cut(V, GM, C, verbose=False): - ``GM`` -- half of the basis matrix of the lattice - - ``C`` -- radius to use in cutting algorithm + - ``C`` -- square of the radius to use in cutting algorithm - ``verbose`` -- boolean (default: ``False``); whether to print debug information @@ -149,9 +149,18 @@ def diamond_cut(V, GM, C, verbose=False): sage: V = diamond_cut(V, GM, 4) sage: V.vertices() (A vertex at (2), A vertex at (0)) + + ALGORITHM: + + Use the algorithm in (2.8) of [FP1985]_ to iterate through the nonzero + vectors ``hv`` of length at most `\sqrt{C}` in the lattice spanned by + ``GM``. (Actually, the algorithm only constructs one vector from each pair + ``{hv, -hv}``.) For each such vector ``hv``, intersect ``V`` with the + half-spaces defined by ``plane_inequality(hv)`` and + ``plane_inequality(-hv)``. """ if verbose: - print("Cut\n{}\nwith radius {}".format(GM, C)) + print("Cut\n{}\nwith squared radius {}".format(GM, C)) dim = GM.dimensions() if dim[0] != dim[1]: From 69e9011b0169f3da1e2da5b69337731dc4b0d7b6 Mon Sep 17 00:00:00 2001 From: Dave Witte Morris Date: Sun, 6 Apr 2025 13:42:53 -0600 Subject: [PATCH 2/2] move ALGORITHM block --- src/sage/modules/diamond_cutting.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sage/modules/diamond_cutting.py b/src/sage/modules/diamond_cutting.py index 679eb36f166..5c0b1c2da7a 100644 --- a/src/sage/modules/diamond_cutting.py +++ b/src/sage/modules/diamond_cutting.py @@ -141,15 +141,6 @@ def diamond_cut(V, GM, C, verbose=False): OUTPUT: a :class:`Polyhedron` instance - EXAMPLES:: - - sage: from sage.modules.diamond_cutting import diamond_cut - sage: V = Polyhedron([[0], [2]]) - sage: GM = matrix([2]) - sage: V = diamond_cut(V, GM, 4) - sage: V.vertices() - (A vertex at (2), A vertex at (0)) - ALGORITHM: Use the algorithm in (2.8) of [FP1985]_ to iterate through the nonzero @@ -158,6 +149,15 @@ def diamond_cut(V, GM, C, verbose=False): ``{hv, -hv}``.) For each such vector ``hv``, intersect ``V`` with the half-spaces defined by ``plane_inequality(hv)`` and ``plane_inequality(-hv)``. + + EXAMPLES:: + + sage: from sage.modules.diamond_cutting import diamond_cut + sage: V = Polyhedron([[0], [2]]) + sage: GM = matrix([2]) + sage: V = diamond_cut(V, GM, 4) + sage: V.vertices() + (A vertex at (2), A vertex at (0)) """ if verbose: print("Cut\n{}\nwith squared radius {}".format(GM, C))