Esempio n. 1
0
rs = get_random_state()

vec_z = rs.randn(n1d) + \
        rs.randn(n1d) * 1j

mat_z =  rs.randn(*size2d) + \
         rs.randn(*size2d) * 1j

arr_z =  rs.randn(*size3d) + \
         rs.randn(*size3d) * 1j

# stride 10
tmp = vec_z[::10]
perf_times = time_func(np.fft.fft, tmp, dict(), refresh_buffer=False)
print_summary(perf_times, header='np.fft.fft' + arg_signature(tmp))

perf_times = time_func(np.fft.fft, mat_z, dict(axis=0), refresh_buffer=False)
print_summary(perf_times, header='np.fft.fft(axis=0)' + arg_signature(mat_z))

tmp = arr_z.T
perf_times = time_func(np.fft.fft2,
                       tmp,
                       dict(),
                       batch_size=8,
                       refresh_buffer=False)
print_summary(perf_times, header='np.fft.fft2' + arg_signature(tmp))

tmp = arr_z.transpose((2, 0, 1))
perf_times = time_func(np.fft.fftn,
                       tmp,
Esempio n. 2
0
    size3d = (273, 274, 275)

rs = get_random_state()

vec_z = rs.randn(n1d) + \
        rs.randn(n1d) * 1j

mat_z =  rs.randn(*size2d) + \
         rs.randn(*size2d) * 1j

arr_z =  rs.randn(*size3d) + \
         rs.randn(*size3d) * 1j

tmp = vec_z
perf_times = time_func(np.fft.fft, tmp, dict(), refresh_buffer=False)
print_summary(perf_times, header='np.fft.fft' + arg_signature(tmp))

tmp = vec_z
perf_times = time_func(scipy.fftpack.fft,
                       tmp,
                       dict(overwrite_x=True),
                       refresh_buffer=True)
print_summary(perf_times, header='scipy.fftpack.fft' + arg_signature(tmp))

tmp = mat_z
perf_times = time_func(np.fft.fft2, tmp, dict(), refresh_buffer=False)
print_summary(perf_times, header='np.fft.fft2' + arg_signature(tmp))

tmp = mat_z
perf_times = time_func(scipy.fftpack.fft2,
                       tmp,
Esempio n. 3
0
buf = np.empty_like(mat_z)
np.copyto(buf, mat_z)
x1 = np.fft.fft2(buf)
del x1
del buf

print("", flush=True)

tf_kw = {'batch_size': 16, 'repetitions': 6}

perf_times = time_func(np.fft.fft,
                       vec_z,
                       dict(),
                       refresh_buffer=False,
                       **tf_kw)
print_summary(perf_times, header='np.fft.fft' + arg_signature(vec_z))

if run_scipy:
    perf_times = time_func(scipy.fftpack.fft, vec_z, dict(overwrite_x=True),
                           **tf_kw)
    print_summary(perf_times,
                  header='scipy.fftpack.fft, overwrite_x=True' +
                  arg_signature(vec_z))

perf_times = time_func(np.fft.fft2,
                       mat_z,
                       dict(),
                       refresh_buffer=False,
                       **tf_kw)
print_summary(perf_times, header='np.fft.fft2' + arg_signature(mat_z))