Skip to content

Instantly share code, notes, and snippets.

View haijohn's full-sized avatar
🎲
Wandering

haijohn

🎲
Wandering
View GitHub Profile
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