8000 Matmul/generic2 by DavidMertz · Pull Request #18 · pydata/sparse · GitHub
[go: up one dir, main page]

Skip to content

Matmul/generic2 #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tweak to pass Travis CI (flake8 is really picky)
  • Loading branch information
David Mertz committed May 2, 2017
commit 9656393114c47d8cef1736cda7f6fb62ab9f28fa
7 changes: 3 additions & 4 deletions sparse/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,13 @@ def T(self):
return self.transpose(list(range(self.ndim))[::-1])

def dot(self, other):
return dot(self, other)

def __matmul__(self, other):
try:
return dot(self, other)
except AttributeError:
except AttributeError: # missing .ndim
return dot(self, np.array(other))

__matmul__ = dot

def __rmatmul__(self, other):
return dot(np.array(other), self)

Expand Down
1 change: 1 addition & 0 deletions sparse/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def test_dot():
a = random_x((3, 4, 5))
b = random_x((5, 6))
l = [1, 2, 3, 4, 5]
l # silencing flake8

sa = COO.from_numpy(a)
sb = COO.from_numpy(b)
Expand Down
0