1 | initial version |
You're not doing anything wrong; it is Sage that is wrong.
Here L.closest_vector(u)
causes L.voronoi_cell()
to be called, which calls (if L._basis_is_LLL_reduced
is False
, first L.LLL()
) the function calculate_voronoi_cell(L.reduced_basis, radius=None)
which is located in sage.modules.diamond_cutting
. Here (with basis = L.reduced_basis
) we find the problem:
max(abs(v) for v in basis).ceil()
This code assumes that the result of max(abs(v) for v in basis)
has a method called ceil()
. This would be true for ordinary numbers as in your first example, but not for symbolic expressions such as sqrt(2)
which appears in your second example.
The solution is to fix this part of Sage's code, e.g. replace the expression by:
max(abs(v).n() for v in basis).ceil()
To get this fix into Sage (for everyone to enjoy) a trac ticket should be opened for this problem and solution.
2 | No.2 Revision |
You're not doing anything wrong; it is Sage that is wrong.
Here L.closest_vector(u)
causes L.voronoi_cell()
to be called, which calls (if L._basis_is_LLL_reduced
is False
, first L.LLL()
) the function
which is located in calculate_voronoi_cell(L.reduced_basis, calculate_voronoi_cell(basis=L.reduced_basis, radius=None)sage.modules.diamond_cutting
. Here (with we find the problem:basis = L.reduced_basis
)
max(abs(v) for v in basis).ceil()
This code assumes that the result of max(abs(v) for v in basis)
has a method called ceil()
. This would be true for ordinary numbers as in your first example, but not for symbolic expressions such as sqrt(2)
which appears in your second example.
The solution is to fix this part of Sage's code, e.g. replace the expression by:
max(abs(v).n() for v in basis).ceil()
To get this fix into Sage (for everyone to enjoy) a trac ticket should be opened for this problem and solution.