Skip to content

Vector equality coercion problems #3638

@sagetrac-jbmohler

Description

@sagetrac-jbmohler

I think this bit of code should not produce an exception. The vectors should both be coerced to belong to Z8!^3 and compared.

sage: Z8=IntegerModRing(8)
sage: vector(ZZ,[1,2,11])==vector(Z8,[1,2,3])
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
...
AttributeError: 'FreeModule_ambient' object has no attribute 'ambient_vector_space'

Note that a similar thing seems to work in other cases (because 7 is prime and Z7 is a field?).

sage: Z7=IntegerModRing(7)
sage: vector(ZZ,[1,2,10])==vector(Z7,[1,2,3])
True

This may or may not be related, but combining QQ and Z7 produces some wrong results:

sage: Z7=IntegerModRing(7)
sage: vector(Z7,[1,2,3])==vector(QQ,[1,2,3])
False

That those vectors are not equal is truly disturbing. This should either raise an exception about not having compatible parents or should be True. I'll let the coercion guru's argue about that. :)

Component: algebra

Author: Robert Bradshaw

Reviewer: Mike Hansen

Merged: sage-4.3.1.rc1

Issue created by migration from https://trac.sagemath.org/ticket/3638

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions