Changes between Version 14 and Version 28 of Ticket #29866


Ignore:
Timestamp:
06/17/20 13:21:16 (9 months ago)
Author:
slelievre
Comment:

Could it be that the conversion to QQ was there for inexact vectors, say vectors over RDF or RR?

Should we add the example in the ticket description as a doctest?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29866

    • Property Status changed from new to needs_review
    • Property Authors changed from to Samuel Lelièvre, Dima Pasechnik
    • Property Cc chapoton added
    • Property Branch changed from to u/dimpase/modules/corrround
    • Property Keywords round added
    • Property Commit changed from to 1faa6aceeb6799ea31517c9b84b3e4164153e78d
  • Ticket #29866 – Description

    v14 v28  
    1 In this example we compute `v`, the closest vector to the vector `u` that lies in the integer lattice `L`.
    2 
    3 These bugs are already in Sage 8.1 (i.e. still Python 2), as well as in the latest 9.2.beta1.
    4 
    5 However, closest_vector works in Sage 8.4, and is broken in 8.5 (membership test still broken, though).
    6 
    7 Problem: `v` is not in `L`.
     1In this example we compute `v`, the closest vector to the vector `u`
     2that lies in the integer lattice `L`. Problem: `v` is not in `L`.
    83{{{
    94sage: from sage.modules.free_module_integer import IntegerLattice
     
    127sage: u = vector([-423434678248195, -18882583298608161305227077482])
    138sage: v = L.closest_vector(u)
    14 sage: print(v in L)
     9sage: v in L
    1510False
    16 sage: MGAP=libgap(M)
    17 sage: vGAP=libgap(v)
    18 sage: libgap.SolutionIntMat(MGAP,vGAP) # independent test that v is not in L
     11sage: MGAP = libgap(M)
     12sage: vGAP = libgap(v)
     13sage: libgap.SolutionIntMat(MGAP, vGAP) # independent test that v is not in L
    1914fail
    2015}}}
    21 A simplified version of Taylor Huang's example posted on sage-devel (https://groups.google.com/g/sage-devel/c/CtPAbZPjoeU/m/qj2IH7LxBAAJ)
    2216
    23 Membership test was reported broken, too (same thread)
     17This is a simplified version of
     18[https://groups.google.com/g/sage-devel/c/CtPAbZPjoeU/m/qj2IH7LxBAAJ Taylor Huang's example posted on sage-devel].
     19
     20This used to work in Sage 8.4, and was broken in 8.5.beta3 by the
     21change from `round(x, 6)` to `x.n(digits=6)` in #26648.
     22
     23The sage-devel thread also reports the membership test to be broken:
    2424{{{
    2525from sage.modules.free_module_integer import IntegerLattice
    26 coef = Matrix([-44429982080874270968379672793605458, 98931650854481334735580708522902113])
    27 bMat = Matrix([[20957228, -4966110],[ 9411844, 19625639]])
     26coef = Matrix([-44429982080874270968379672793605458,
     27    98931650854481334735580708522902113])
     28bMat = Matrix([[20957228, -4966110], [9411844, 19625639]])
    2829L = IntegerLattice(bMat)
    29 coef*bMat in L # prints false
    30 bMatGAP=libgap(bMat)
    31 v=libgap(coef*bMat)[0]
    32 sol=libgap.SolutionIntMat(bMatGAP,v); sol # prints
     30coef*bMat in L  # should be true, but returns False
     31bMatGAP = libgap(bMat)
     32v = libgap(coef*bMat)[0]
     33sol = libgap.SolutionIntMat(bMatGAP, v); sol # prints
    3334# [ -423434671769860, -18882583298608161305225815339 ]
    34 vector(sol.sage())*bMat==vector(coef*bMat) # sanity check - prints True
     35vector(sol.sage())*bMat == vector(coef*bMat) # sanity check - prints True
    3536}}}
    3637
    37 but this is merely a type "error", in the sense that `coef` is not a vector, but a 1x2 matrix (a different type, and automatic conversion does not happen here). Not sure whether the latter warrants a fix.
     38but this is merely a type "error", in the sense that `coef` is not a vector,
     39but a 1x2 matrix (a different type, and automatic conversion does not happen here).
     40Not sure whether the latter warrants a fix.