On 3/17/11 6:06 AM, David Roe wrote:
for is a function of the hash of its elements to
satisfy equal matrices over different parents having the same hash.
Err, sorry, I don't manage to parse the end of the sentence. Do you
mind reformulating?
I think what Robert was trying to say is that if R and S are different
rings, and M is a matrix over R then
hash(M.change_ring(S)) == hash(M) as much as possible.
It seems that that problem should be pushed down to the entries in the
matrix itself. If two matrices have elements that all have
corresponding hashes, then it would make sense that the matrices have
corresponding hashes.
Here's one idea that may be too computationally expensive to be useful:
calculate the logical xors
def hash(self):
h=0
for i,j,entry in m.nonzero_entries(): # nonzero entries for sparse
matrices
h^=hash(entry)^i^j
return h
Of course, we have the same problems that we have with normal equality
testing: if S=Integers(1), then the requirement above conflicts with the
desire to have different hash values for different matrices.
I think Integers(1) is probably a very special case that we shouldn't
worry too much about!
Jason
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org