By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When trying to interpolate big datasets, scipy.interpolate.Rbf objects tend to use a lot of memory (resulting in MemoryErrors especially if several Rbf objects with many nodes are used at the same time). This is mainly due to the objects retaining a copy of the matrix Rbf.A, which as N^2 elements (where N is the number of nodes). As far as I can see, Rbf.A is not used after it is used to calculate the coefficients (Rbf.nodes) in Rbf. init and deleting the matrix (del rbf.A) after construction seems not to affect the function of the Object.

Hence, unless there is a very good reason to retain this matrix, I would suggest changing it from a class member to a local variable to init :

current code (lines 221 and 222):

        self.A = self._init_function(r) - np.eye(self.N)*self.smooth
        self.nodes = linalg.solve(self.A, self.di)

suggested change

        A = self._init_function(r) - np.eye(self.N)*self.smooth
        self.nodes = linalg.solve(A, self.di)