If no indexURL is provided, we throw and catch an error and
then use ErrorStackParser to calculate where pyodide.js has
been loaded from. Resolves #2290.
ENH Calculate indexURL from error stack trace. If no indexURL is provided, we throw and catch an error and
then use ErrorStackParser to calculate where pyodide.js has
been loaded from. Resolves #2290.
# from: http://stackoverflow.com/questions/2196693/improving-numpy-performance
# pythran export specialconvolve(uint32 [][])
# setup: import numpy as np ; r = np.arange(100*10000, dtype=np.uint32).reshape(1000,1000)
# run: specialconvolve(r)


def specialconvolve(a):
    # sorry, you must pad the input yourself
    rowconvol = a[1:-1, :] + a[:-2, :] + a[2:, :]
    colconvol = (
        rowconvol[:, 1:-1] + rowconvol[:, :-2] + rowconvol[:, 2:] - 9 * a[1:-1, 1:-1]
    )
    return colconvol

# from: http://stackoverflow.com/questions/2196693/improving-numpy-performance
# pythran export specialconvolve(uint32 [][])
# setup: import numpy as np ; r = np.arange(100*10000, dtype=np.uint32).reshape(1000,1000)
# run: specialconvolve(r)


def specialconvolve(a):
    # sorry, you must pad the input yourself
    rowconvol = a[1:-1, :] + a[:-2, :] + a[2:, :]
    colconvol = (
        rowconvol[:, 1:-1] + rowconvol[:, :-2] + rowconvol[:, 2:] - 9 * a[1:-1, 1:-1]
    )
    return colconvol
