def __mul__(self, other): if isinstance(other, Number): return Matrix(API.scalarMultiply(self._matrix, other)) elif isinstance(other, Vector): return Vector(API.operate(self._matrix, other._vector)) else: return Matrix(API.multiply(self._matrix, other._matrix))