Seems like a correct approach.  But I wonder if it's faster to do:

```
hash(self.get_matrix().tostring())
```

(Don't know if it is, just though the code would spend more time in C that way...)