示例#1
0
    def operate(self, invec=None, queue=None, verbose=False):
        if invec != None:
            if isinstance(invec, mpArray):
                self.setIn(invec)
            elif isinstance(invec, list) and self.dim==len(invec):
                self.setIn(mpArray(invec))

        qvec = self.operator[0]*self.stateIn
        pvec = mpArray(mpfft.fft(qvec))#, inverse=False, verbose=verbose))
        
        
        pvec = self.operator[1]*pvec #[self.operator[1].data[i]*pvec[i] for i in range(self.dim)]
        qvec = mpArray(mpfft.ifft(pvec))#, inverse=True, verbose=verbose))
        
        qvec = self.operator[0]*qvec
        pvec = mpArray(mpfft.fft(qvec))#, inverse=False, verbose=verbose))
        
        self.stateOut = mpArray(mpfft.ifft(pvec))#, inverse=True, verbose=verbose))
        
        if queue !=None: 
            queue.put(self.stateOut)
示例#2
0
 def operate(self, invec=None, queue=None, verbose=False):
     if invec != None:
         self.setIn(invec)
     ## tood: 一度だけしか呼びたくない
     if self._isShift():
         self.absorber[1] = self.absorber[1].fftshift()
     qvec = self.absorber[0]*self.operator[0]*self.stateIn
     pvec = mpArray(mpfft.fft(qvec))#, inverse=False, verbose=verbose))
     pvec = self.absorber[1]*self.operator[1]*pvec 
     qvec = self.absorber[0]*mpArray(mpfft.ifft(pvec))#, inverse=True, verbose=verbose))
     self.stateOut = State(self.scaleinfo, qvec)
     if queue !=None: 
         queue.put(self.stateOut)