Пример #1
0
 def enlarge(self, M):
     """
     It enlarges a trigonometric polynomial by adding zeros to the Fourier
     coefficients with high frequencies.
     """
     if np.allclose(self.N, M):
         return self
     val = np.zeros(np.hstack([self.d, M]), dtype=self.val.dtype)
     if self.Fourier is False:
         for m in np.arange(self.d):
             val[m] = enlargeF(self.val[m], M)
     else:
         for m in np.arange(self.d):
             val[m] = enlarge(self.val[m], M)
     return VecTri(name=self.name, val=val, Fourier=self.Fourier)
Пример #2
0
def enlargeF(xN, M):
    """
    It enlarges an array of grid values. First, Fourier coefficients are
    calculated and complemented by zeros. Then an inverse DFT provides
    the grid values on required grid.
 
    Parameters
    ----------
    xN : numpy.ndarray of shape = N
        input array that is to be enlarged
 
    Returns
    -------
    xM : numpy.ndarray of shape = M
        output array that is enlarged
    M : array like
        number of grid points
    """
    N = np.array(np.shape(xN))
    M = np.array(M, dtype=np.int32)
    FxM = enlarge(DFT.fftnc(xN, N)*np.float(np.prod(M))/np.prod(N), M)
    xM = np.real(DFT.ifftnc(FxM, M))
    return xM