instantiating interp1d() is pathologically slow for me, why?

David Mikolas <[email protected]>
Newsgroups gmane.comp.python.scientific.user
Message-ID <CAFYhK+4pT8aHG_uKjnSgmku8b9kXafnP-FNXO=gJNmJ3OgCK9Q@mail.gmail.com>
I've just posted this question in SO as well, happy with an answer either
place:

https://stackoverflow.com/q/49427533/3904031

The following takes over a minute for a few thousand points, whereas it
seems it should be taking milliseconds.

np.__version__    '1.13.0'
scipy.__version__ '0.17.0'


https://i.stack.imgur.com/3C69J.png

    import time
    import numpy as np
    import matplotlib.pyplot as plt
    from scipy.interpolate import interp1d

    times = []
    for n in np.logspace(1, 3.5, 6).astype(int):
        x = np.arange(n, dtype=float)
        y = np.vstack((np.cos(x), np.sin(x)))
        start = time.clock()
        bob = interp1d(x, y, kind='quadratic', assume_sorted=True)
        times.append((n, time.clock() - start))

    n, tim = zip(*times)

    plt.figure()
    plt.plot(n, tim)
    plt.xscale('log')
    plt.yscale('log')
    plt.show()

_______________________________________________
SciPy-User mailing list
[email protected]
https://mail.python.org/mailman/listinfo/scipy-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.