Skip to content

Commit

Permalink
+1 (damn web editor)
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Feb 28, 2024
1 parent 8f380e5 commit 8319c1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions mpmath/matrices/matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def _toliststr(self):
for i in range(rows):
s += '['
for j in range(cols):
if not avoid_type or not isinstance(self[i,j], typ):
if not isinstance(self[i,j], typ):
a = repr(self[i,j])
else:
a = "'" + str(self[i,j]) + "'"
Expand Down Expand Up @@ -736,19 +736,19 @@ def rows(self, value):
for key in self._data.copy():
if key[0] >= value:
del self._data[key]
self.shape[0] = value
self.shape = (value, self.shape[1])

@property
def cols(self):
"""Number of columns."""
return self._cols
return self.shape[1]

@cols.setter
def cols(self, value):
for key in self._data.copy():
if key[1] >= value:
del self._data[key]
self.shape[0] = value
self.shape = (self.shape[0], value)

def transpose(self):
rows, cols = self.shape
Expand Down
2 changes: 1 addition & 1 deletion mpmath/tests/test_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,4 @@ def _check(dat, ref, tol=1e-9):
_check(mp.logm(c), sl.logm(c.astype(complex)))
_check(mp.sqrtm(c), sl.sqrtm(c.astype(complex)))
_check(mp.cosm(c), sl.cosm(c.astype(complex)))
_check(mp.sinm(c), sl.sinm(c.astype(complex)))
_check(mp.sinm(c), sl.sinm(c.astype(complex)))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Documentation = 'http://mpmath.org/doc/current/'
[project.optional-dependencies]
tests = ['pytest>=6', 'numpy; python_version<"3.13"',
'matplotlib; python_version<"3.13"',
'scipy; python_version>"3.10"']
'scipy; python_version>"3.10" and python_version<"3.13"']
develop = ['mpmath[tests]', 'flake518>=1.5; python_version>="3.9"',
'pytest-cov', 'wheel', 'build']
gmpy = ['gmpy2>=2.1.0a4; platform_python_implementation!="PyPy" and python_version<"3.12"',
Expand Down

0 comments on commit 8319c1b

Please sign in to comment.