Last active
June 15, 2019 15:23
-
-
Save haijohn/22d13d7933f17992bc8492c1a6182caf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __mul__(self, other): | |
if isinstance(other, (N.ndarray, list, tuple)) : | |
# This promotes 1-D vectors to row vectors | |
return N.dot(self, asmatrix(other)) | |
if isscalar(other) or not hasattr(other, '__rmul__') : | |
return N.dot(self, other) | |
return NotImplemented |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment