Please don't go backwards. We know what to do and the fix is
straightforward, I think:
```
def submatrix(self, keys):
rlo, rhi, clo, chi = self.key2bounds(keys)
r, c = rhi - rlo, chi - clo
if r*c < len(self._smat):
# the subregion is smaller than the number of elements in self
if r == 1:
getter = lambda i, j: self[rlo, j + clo]
elif c == 1:
getter = lambda i, j: self[i + rlo, clo]
else:
getter = lambda i, j: self[i + rlo, j + clo]
return self._new(r, c, getter)
else:
# the number of non-zero elements is smaller than the subregion
smat = {}
for rk, ck in self._smat:
if rlo <= rk <= rhi and clo <= ck <= chi:
smat[k] = self._smat[k]
return self._new(r, c, smat)
```
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.