Skip to content

Commit 9d43795

Browse files
author
Release Manager
committed
sagemathgh-38841: Fix `transformation` parameter for LLL on matrices over QQ <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> There was an oversight when interpreting the result of LLL() on an integer matrix which lead to a type error. It assumed a matrix would always be returned but if `transformation=True` was passed it would instead be a tuple. This is now fixed and a test has been added. If a `transformation` parameter is added for BKZ in the future this will need to be done for it as well. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. URL: sagemath#38841 Reported by: TheBlupper Reviewer(s):
2 parents 8a5615f + b8fa032 commit 9d43795

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/sage/matrix/matrix_rational_dense.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,13 +2955,19 @@ cdef class Matrix_rational_dense(Matrix_dense):
29552955
[ 1/28 -1/40 -1/18]
29562956
[ 1/28 -1/40 1/18]
29572957
[ 0 -3/40 0]
2958+
sage: L, U = A.LLL(transformation=True)
2959+
sage: U * A == L
2960+
True
29582961
29592962
sage: A = random_matrix(QQ, 10, 10)
29602963
sage: d = lcm(a.denom() for a in A.list())
29612964
sage: A.LLL() == (A * d).change_ring(ZZ).LLL() / d
29622965
True
29632966
"""
29642967
A, d = self._clear_denom()
2968+
if kwargs.get('transformation', False):
2969+
L, U = A.LLL(*args, **kwargs)
2970+
return L / d, U
29652971
return A.LLL(*args, **kwargs) / d
29662972

29672973
def is_LLL_reduced(self, delta=None, eta=None):

0 commit comments

Comments
 (0)