Open mahrud opened 5 years ago
It should be easy to make the submatrix routine produce a new hash code, the next one in the sequence. It's probably doing a low-level copy operation that simply copies the hash code, too.
Does hash also depend on the location of the object in ram?
I wanted to use it to distinguish pointers to the same object. Is there a way to do that? (I understand that the location of an object can change, but it can be used to detect when two mutable objects are pointing to the same location)
Does hash also depend on the location of the object in ram?
No. One design principle used is that Macaulay2 should give the same answers on all machines.
I wanted to use it to distinguish pointers to the same object. Is there a way to do that? (I understand that the location of an object can change, but it can be used to detect when two mutable objects are pointing to the same location)
No, there is no way to do that. It doesn't make much sense to want that either -- pointers to the same object have exactly the same behavior, and it's the object they point to that is what's important for us.
Despite the fact that submatrix makes a copy of mutable matrices, hash of the two objects stays the same.