コード例 #1
0
ファイル: SIRF.py プロジェクト: devhliu/SIRF
 def multiply(self, other):
     '''
     Returns the elementwise product of this and another container 
     data viewed as vectors.
     other: DataContainer
     '''
     assert_validities(self, other)
     z = self.same_object()
     z.handle = pysirf.cSIRF_multiply(self.handle, other.handle)
     check_status(z.handle)
     return z
コード例 #2
0
 def multiply(self, other, out=None):
     '''
     Returns the elementwise product of this and another container 
     data viewed as vectors.
     other: DataContainer
     out:   DataContainer to store the result to.
     '''
     if isinstance(other, (Number, int, float, numpy.float32)):
         tmp = other + numpy.zeros(self.as_array().shape)
         other = self.copy()
         other.fill(tmp)
     assert_validities(self, other)
     if out is None:
         z = self.same_object()
     else:
         assert_validities(self, out)
         z = out
     z.handle = pysirf.cSIRF_multiply(self.handle, other.handle)
     check_status(z.handle)
     return z
コード例 #3
0
 def multiply(self, other, out=None):
     '''
     Returns the elementwise product of this and another container 
     data viewed as vectors.
     other: DataContainer
     out:   DataContainer to store the result to.
     '''
     if not isinstance (other, ( DataContainer , Number )):
         return NotImplemented
     if isinstance(other , Number):
         tmp = other + numpy.zeros(self.shape, self.dtype)
         other = self.copy()
         other.fill(tmp)
     assert_validities(self, other)
     if out is None:
         out = self.same_object()
         out.handle = pysirf.cSIRF_product(self.handle, other.handle)
         check_status(out.handle)
         #out = self.copy()
     else:
         assert_validities(self, out)
         try_calling(pysirf.cSIRF_multiply(self.handle, other.handle, out.handle))
     return out