Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector equality coercion problems #3638

Closed
sagetrac-jbmohler mannequin opened this issue Jul 11, 2008 · 5 comments
Closed

Vector equality coercion problems #3638

sagetrac-jbmohler mannequin opened this issue Jul 11, 2008 · 5 comments

Comments

@sagetrac-jbmohler
Copy link
Mannequin

sagetrac-jbmohler mannequin commented Jul 11, 2008

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

@sagetrac-jbmohler sagetrac-jbmohler mannequin added this to the sage-4.3.1 milestone Jul 11, 2008
@malb malb self-assigned this Jan 25, 2009
@robertwb
Copy link
Contributor

comment:2

Attachment: 3638-free-module-coerce.patch.gz

Fixed the Z/8Z case. As for Z/7Z and Q, they are incomparable, which by convention means == returns False. (If it gave an error,we would have to re-think nonsense like "some string" != random_matrix(ZZ, 3) returning False).

@mwhansen
Copy link
Contributor

comment:3

Looks good to me.

@mwhansen
Copy link
Contributor

Author: Robert Bradshaw

@mwhansen
Copy link
Contributor

Reviewer: Mike Hansen

@rlmill
Copy link
Mannequin

rlmill mannequin commented Jan 19, 2010

Merged: sage-4.3.1.rc1

@rlmill rlmill mannequin removed the s: positive review label Jan 19, 2010
@rlmill rlmill mannequin closed this as completed Jan 19, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants