Opened 13 years ago

Closed 11 years ago

# Vector equality coercion problems

Reported by: Owned by: jbmohler malb major sage-4.3.1 algebra sage-4.3.1.rc1 Robert Bradshaw Mike Hansen N/A

### Description

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. :)

### comment:1 Changed 12 years ago by malb

• Owner changed from tbd to malb
• Status changed from new to assigned

### comment:2 Changed 11 years ago by robertwb

• Report Upstream set to N/A
• Status changed from new to needs_review

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).

### comment:3 Changed 11 years ago by mhansen

• Authors set to Robert Bradshaw
• Reviewers set to Mike Hansen
• Status changed from needs_review to positive_review

Looks good to me.

### comment:4 Changed 11 years ago by rlm

• Merged in set to sage-4.3.1.rc1
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.