示例#1
0
 def __sub__(self, other):
     if isinstance(other, Number):
         return Matrix(API.scalarAdd(self._matrix, -other))
     else:
         return Matrix(API.subtract(self._matrix, other._matrix))
示例#2
0
 def __add__(self, other):
     if isinstance(other, Number):
         return Matrix(API.scalarAdd(self._matrix, other))
     else:
         return Matrix(API.add(self._matrix, other._matrix))