Esempio n. 1
0
 def dot(self, other):
     '''
     Returns the dot product of the container data with another container 
     data viewed as vectors.
     other: DataContainer
     '''
     ##        assert self.handle is not None
     ##        assert type(self) == type(other)
     assert_validities(self, other)
     handle = pygadgetron.cGT_dot(self.handle, other.handle)
     check_status(handle)
     re = pyiutil.floatReDataFromHandle(handle)
     im = pyiutil.floatImDataFromHandle(handle)
     pyiutil.deleteDataHandle(handle)
     return complex(re, im)
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