Esempio n. 1
0
File: SIRF.py Progetto: devhliu/SIRF
 def dot(self, other):
     '''
     Returns the dot product of the container data with another container 
     data viewed as vectors.
     other: DataContainer
     '''
     assert_validities(self, other)
     handle = pysirf.cSIRF_dot(self.handle, other.handle)
     check_status(handle)
     r = pyiutil.floatDataFromHandle(handle)
     pyiutil.deleteDataHandle(handle)
     return r
Esempio n. 2
0
 def dot(self, other):
     '''
     Returns the dot product of the container data with another container 
     data viewed as vectors.
     other: DataContainer
     '''
     assert_validities(self,other)
     # Check if input are the same size
     if numpy.prod(self.dimensions()) != numpy.prod(other.dimensions()):
         raise ValueError("Input sizes are expected to be equal, got " + numpy.prod(self.dimensions()) + " and " + numpy.prod(other.dimensions()) + " instead.")
     handle = pysirf.cSIRF_dot(self.handle, other.handle)
     check_status(handle)
     re = pyiutil.floatReDataFromHandle(handle)
     im = pyiutil.floatImDataFromHandle(handle)
     pyiutil.deleteDataHandle(handle)
     if im == 0:
         return re
     else:
         return re + 1j*im