def m(self, b): return Matrix(self.array * asarray(b))
def asarray(self, t=None): if t is None: return self.array else: return asarray(self.array, t)
def __setitem__(self, index, value): value = asarray(value, self._typecode) if multiply.reduce(value.shape) == 1: value = value[0, 0] self.array[index] = value
def __setslice__(self, i, j, value): self.array[i:j] = asarray(squeeze(value), self._typecode)
def __rmul__(self, other): aother = asarray(other) if len(aother.shape) == 0: return self._rc(aother*self.array) else: return self._rc(dot(aother, self.array))
def __imul__(self, other): aother = asarray(other) self.array = dot(self.array, aother) return self
def asarray(self,t=None): if t is None: return self.array else: return asarray(self.array,t)
def __setitem__(self, index, value): value = asarray(value, self._typecode) self.array[index] = squeeze(value)
def __setslice__(self, i, j, value): self.array[i:j] = asarray(squeeze(value),self._typecode) def __float__(self):
def m(self,b): return Matrix(self.array * asarray(b))
def __imul__(self,other): aother = asarray(other) self.array = dot(self.array, aother) return self
def __setitem__(self, index, value): value = asarray(value, self._typecode) if multiply.reduce(value.shape) == 1: value = value[0,0] self.array[index] = value
def __mul__(self, other): aother = asarray(other) if len(aother.shape) == 0: return self._rc(self.array * aother) else: return self._rc(dot(self.array, aother))
def __mul__(self, other): aother = asarray(other) if len(aother.shape) == 0: return self._rc(self.array*aother) else: return self._rc(dot(self.array, aother))
def __rmul__(self, other): aother = asarray(other) if len(aother.shape) == 0: return self._rc(aother * self.array) else: return self._rc(dot(aother, self.array))
import string