2022-08-31 23:07:45 +0200 | received badge | ● Famous Question (source) |
2021-05-25 02:14:45 +0200 | received badge | ● Notable Question (source) |
2020-06-08 13:59:46 +0200 | received badge | ● Popular Question (source) |
2018-12-03 02:14:02 +0200 | received badge | ● Scholar (source) |
2018-12-02 23:50:56 +0200 | commented answer | Error in finding the closest vector in a sublattice of Z^n Okay, I guess I should just treat the "discrete subgroups of Z^n" as a not-fully-implemented part of Sage. Honestly, for my purposes one of the main things I want to do is simply orthogonally project a vector onto a subspace spanned by the columns of a matrix, which is functionality Sage also seems not to have built-in anywhere I can find it. |
2018-12-02 23:20:01 +0200 | commented answer | Error in finding the closest vector in a sublattice of Z^n Thanks! This change fixed the simple example in the original post, but some more complicated examples still give me errors. For instance, |
2018-12-02 19:53:00 +0200 | commented answer | Error in finding the closest vector in a sublattice of Z^n Great! In the meantime is there a way for me to make the code run properly? I confess that I don't know how to "fix parts of Sage's code." |
2018-12-02 19:52:20 +0200 | received badge | ● Supporter (source) |
2018-12-02 19:05:56 +0200 | received badge | ● Nice Question (source) |
2018-12-02 13:38:59 +0200 | received badge | ● Student (source) |
2018-12-02 13:32:38 +0200 | asked a question | Error in finding the closest vector in a sublattice of Z^n I'm trying to use the Sage package for discrete subgroups of Z^n. But the "closest_vector()" function seems to be behaving incorrectly. Here are some examples: The input from sage.modules.free_module_integer import IntegerLattice L = IntegerLattice([[2,0,0],[0,1,0]]) L u=[0,0,0] L.closest_vector(u) yields the output Free module of degree 3 and rank 2 over Integer Ring User basis matrix: [0 1 0] [2 0 0] (0, 0, 0) as expected. But the input from sage.modules.free_module_integer import IntegerLattice L = IntegerLattice([[2,0,0],[1,1,0]]) L u=[0,0,0] L.closest_vector(u) yields the output Free module of degree 3 and rank 2 over Integer Ring User basis matrix: [ 1 1 0] [ 1 -1 0] Error in lines 5-5 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> File "/ext/sage/sage-8.4_1804/local/lib/python2.7/site-packages/sage/modules/free_module_integer.py", line 787, in closest_vector voronoi_cell = self.voronoi_cell() File "sage/misc/cachefunc.pyx", line 1953, in sage.misc.cachefunc.CachedMethodCaller.__call__ (build/cythonized/sage/misc/cachefunc.c:10824) w = self._instance_call(*args, **kwds) File "sage/misc/cachefunc.pyx", line 1829, in sage.misc.cachefunc.CachedMethodCaller._instance_call (build/cythonized/sage/misc/cachefunc.c:10280) return self.f(self._instance, *args, **kwds) File "/ext/sage/sage-8.4_1804/local/lib/python2.7/site-packages/sage/modules/free_module_integer.py", line 724, in voronoi_cell return calculate_voronoi_cell(B, radius=radius) File "/ext/sage/sage-8.4_1804/local/lib/python2.7/site-packages/sage/modules/diamond_cutting.py", line 263, in calculate_voronoi_cell artificial_length = max(abs(v) for v in basis).ceil() * 2 File "sage/structure/element.pyx", line 493, in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4550) return self.getattr_from_category(name) File "sage/structure/element.pyx", line 506, in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4659) return getattr_from_other_class(self, cls, name) File "sage/cpython/getattr.pyx", line 394, in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2536) raise AttributeError(dummy_error_message) AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'ceil' What am I doing wrong? |