Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f50a60c6 authored by hhakim's avatar hhakim
Browse files

Fix pyfaust LazyLinearOp indexing by just an int (eg. lop[0]).

parent 301bd00b
Branches
Tags
No related merge requests found
...@@ -644,6 +644,8 @@ class LazyLinearOp(LinearOperator): ...@@ -644,6 +644,8 @@ class LazyLinearOp(LinearOperator):
""" """
self._checkattr('__getitem__') self._checkattr('__getitem__')
if isinstance(indices, int):
indices = (indices, slice(0, self.shape[1]))
if isinstance(indices, tuple) and len(indices) == 2 and isinstance(indices[0], int) and isinstance(indices[1], int): if isinstance(indices, tuple) and len(indices) == 2 and isinstance(indices[0], int) and isinstance(indices[1], int):
return self.toarray().__getitem__(indices) return self.toarray().__getitem__(indices)
elif isinstance(indices, slice) or isinstance(indices[0], slice) and \ elif isinstance(indices, slice) or isinstance(indices[0], slice) and \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment