示例#1
0
 def __rpow__(self, other):
     if(isinstance(other, numbers.Number) and numpy.issubdtype(type(other), numpy.float) and
        numpy.issubdtype(self.dtype, numpy.integer)):
         # AF does not automatically upconvert A**0.5 to float for integer arrays
         s = arrayfire.pow(pu.raw(other), self.astype(type(other)).d_array)
     else:
         s = arrayfire.pow(pu.raw(other), self.d_array)
     return ndarray(self.shape, dtype=pu.typemap(s.dtype()), af_array=s)
示例#2
0
 def __ne__(self, other):
     if(other is None):
         return True
     s = self.d_array != pu.raw(other)
     return ndarray(self.shape, dtype=numpy.bool, af_array=s)
示例#3
0
 def __eq__(self, other):
     if(other is None):
         return False
     s = self.d_array == pu.raw(other)
     return ndarray(self.shape, dtype=numpy.bool, af_array=s)
示例#4
0
 def __ge__(self, other):
     s = self.d_array >= pu.raw(other)
     return ndarray(self.shape, dtype=numpy.bool, af_array=s)
示例#5
0
 def __rdiv__(self, other):
     s = pu.raw(other) / self.d_array
     return ndarray(self.shape, dtype=pu.typemap(s.dtype()), af_array=s)
示例#6
0
 def __idiv__(self, other):
     afnumpy.divide(self, pu.raw(other), out=self)
     return self
示例#7
0
 def __imul__(self, other):
     afnumpy.multiply(self, pu.raw(other), out=self)
     return self
示例#8
0
 def __mul__(self, other):
     s = self.d_array * pu.raw(other)
     return ndarray(self.shape, dtype=pu.typemap(s.dtype()), af_array=s)
示例#9
0
 def __isub__(self, other):
     afnumpy.subtract(self, pu.raw(other), out=self)
     return self
示例#10
0
 def __iadd__(self, other):
     self[:] = self[:] + pu.raw(other)
     return self