Opened 5 months ago

Last modified 2 weeks ago

#33882 new defect

.coordinate_vector() for IntegerLattice does not respect the base ring (ZZ)

Reported by: Max Alekseyev Owned by:
Priority: major Milestone: sage-9.8
Component: linear algebra Keywords:
Cc: Lorenz Panny Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps: todo

Status badges

Description (last modified by Max Alekseyev)

The following code demonstrates that despite IntegerLattice being defined as a module over ZZ, its .component_vector() method fails to recognize that a given vector is not in self and proceeds with representing it as a linear combination with fractional coefficients.

from sage.modules.free_module_integer import IntegerLattice

L = IntegerLattice([2,2,2])
r = vector(ZZ,[1,1,1])

print(r in L)                             # this is False
print(L.coordinate_vector(r,check=True))  # check should fail, and exception should be raised but it's not

On a related note, it is unclear how L.coordinate_vector(r) behaves when r does belong to L. I'd expect it to return a vector with integer components, but given the above behavior it seems that it may return a vector with fractional components anyway. It should stick to the base ring, i.e. ZZ in this case, or at least have an option to enforce this.

Change History (5)

comment:1 Changed 5 months ago by Max Alekseyev

Description: modified (diff)

comment:2 Changed 5 months ago by Max Alekseyev

Description: modified (diff)

comment:3 Changed 2 months ago by Max Alekseyev

Stopgaps: todo

comment:4 Changed 2 months ago by Lorenz Panny

Cc: Lorenz Panny added

comment:5 Changed 2 weeks ago by Matthias Köppe

Milestone: sage-9.7sage-9.8
Note: See TracTickets for help on using tickets.