{"id":360994,"date":"2024-05-21T01:04:21","date_gmt":"2024-05-21T01:04:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=360994"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=360994","title":{"rendered":"<span>\u041a\u0430\u043a \u0443\u0442\u0435\u0440\u0435\u0442\u044c \u043d\u043e\u0441 NumPy \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0411\u041f\u0424<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0432\u0437\u043e\u0439\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 NumPy \u043d\u0430 \u0446\u0435\u043b\u044b\u0445 50% \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dad\/9cc\/79f\/dad9cc79f4d70441c572b61789d6e5e6.png\" width=\"828\" height=\"516\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dad\/9cc\/79f\/dad9cc79f4d70441c572b61789d6e5e6.png\"\/><\/figure>\n<p>\u0414\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u043d\u0430\u0443\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0435\u0442\u0438\u044f. \u041e\u043d \u043d\u0430\u0448\u0435\u043b \u0448\u0438\u0440\u043e\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u2014 \u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 Instagram \u0434\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 MP3-\u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0440\u044f\u0434\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u0430\u0436\u0435 \u043d\u0435\u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u0438\u0437 NumPy. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c, \u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0438 \u0441\u0442\u0430\u0442\u044c\u0438 2015 \u0433\u043e\u0434\u0430 \u043c\u044b \u043e\u0431\u043e\u0448\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c NumPy \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0430\u0436 \u043d\u0430 30-60%. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u044d\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0441\u043b\u0430\u0431\u043e\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435.<\/p>\n<p>\u041f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0439 NumPy, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0411\u041f\u0424 (FFT) \u043a \u0434\u0432\u0443\u043c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>\u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432 2015 \u0433\u043e\u0434\u0443 \u0434\u0432\u043e\u0435 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0443\u0447\u0435\u043d\u044b\u0445 <a href=\"https:\/\/link.springer.com\/article\/10.1134\/S1054661815010137\"><u>\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438<\/u><\/a> \u0441\u0432\u043e\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0438\u0434\u0435\u044e \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0431\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0438\u0445 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0432 \u0435\u0435 \u043f\u0430\u0440\u043e\u0447\u043a\u043e\u0439 \u0441\u0432\u043e\u0438\u0445 \u0438\u0434\u0435\u0439.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/1ed\/a94\/fc2\/1eda94fc21470b464d1729bf6777f3ed.jpeg\" alt=\"M.\u0412. \u041d\u043e\u0441\u043a\u043e\u0432, \u0430\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438\" title=\"M.\u0412. \u041d\u043e\u0441\u043a\u043e\u0432, \u0430\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438\" width=\"512\" height=\"512\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1ed\/a94\/fc2\/1eda94fc21470b464d1729bf6777f3ed.jpeg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>M.\u0412. \u041d\u043e\u0441\u043a\u043e\u0432, \u0430\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0432 \u043d\u0430\u0438\u0432\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438, \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"python\">void _fft2d( \/* \u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 N *\/ ) {   \/\/ \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 {   if (N == 1) return;   \/\/ } \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439     int n = N >> 1;        \/* \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 {      ...\u0417\u0434\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f 4 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446\u044b...        \/\/ X(x, y, i, j)   \/\/ x, y -- \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c   \/\/ i, j -- \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0434\u043c\u0430\u0442\u0440\u0438\u0446\u0435     _fft2d(&amp;X(0, 0), root * root, ...);   _fft2d(&amp;X(0, 1), root * root, ...);   _fft2d(&amp;X(1, 0), root * root, ...);   _fft2d(&amp;X(1, 1), root * root, ...);   } \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 *\/    for (int i = 0; i &lt; n; i++) {     for (int j = 0; j &lt; n; j++) {       auto x00 = X(0, 0, i, j);       auto x10 = X(1, 0, i, j) * \/* W[i] *\/;       auto x01 = X(0, 1, i, j) * \/* W[j] *\/;       auto x11 = X(1, 1, i, j) * \/* W[i] * W[j] *\/;       X(0, 0, i, j) = x00 + x10 + x01 + x11;       X(0, 1, i, j) = x00 + x10 - x01 - x11;       X(1, 0, i, j) = x00 - x10 + x01 - x11;       X(1, 1, i, j) = x00 - x10 - x01 + x11;     }   } }<\/code><\/pre>\n<p>\u041b\u044e\u0431\u043e\u0439 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u043f\u0443\u0442\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f. \u0412\u043e\u0442 \u043a\u0430\u043a \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043c\u044b:<\/p>\n<pre><code class=\"python\">void _fft2d( \/* \u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 N *\/ ) {   \/\/ \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 {   if (N == 1) return;   if (N == 2) { #define Y(y, x) (V[(y)*rowsize + (x)])     auto x00 = Y(0, 0);     auto x10 = Y(1, 0);     auto x01 = Y(0, 1);     auto x11 = Y(1, 1);     Y(0, 0) = x00 + x10 + x01 + x11;     Y(0, 1) = x00 + x10 - x01 - x11;     Y(1, 0) = x00 - x10 + x01 - x11;     Y(1, 1) = x00 - x10 - x01 + x11;     return;   }   \/\/ } \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439     \/\/ ... }<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0430\u0433 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u043c \u0448\u0430\u0433\u0435 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/algorithmica.org\/ru\/fft\"><u>algorithmica<\/u><\/a>, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0432 \u0435\u0435 \u0434\u043b\u044f \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0414\u0430\u043d\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u043a\u044d\u0448\u0443.<\/p>\n<pre><code class=\"python\">\/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f rev_bits[n] auto revbits = [](size_t *v, size_t n) {   int lg_n = log2(n);   forn(i, n) {     int revi = 0;     forn(l, lg_n) revi |= ((i >> l) &amp; 1) &lt;&lt; (lg_n - l - 1);     v[i] = revi;   } };  size_t *rev_n = new size_t[N], *rev_m = new size_t[M]; revbits(rev_n, N), revbits(rev_m, M);    \/\/ \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 forn(i, N) {   int rev_i = rev_n[i];   forn(j, M) {     if ((i &lt; rev_i) || ((i == rev_i) &amp;&amp; (j &lt; rev_m[j])))       std::swap(V[i * M + j], V[rev_i * M + rev_m[j]]);   } }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u043a\u043e\u0440\u043d\u0435\u0439 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b:<\/p>\n<pre><code class=\"python\">int mxdim = std::max(N, M); const int lg_dim = log2(mxdim); auto W = new fft_type[mxdim]; auto rooti = std::polar(1., (inverse ? 2 : -2) * fft::pi \/ mxdim);  \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u043d\u0435\u0439 auto cur_root = rooti; W[0] = 1; forn (i, mxdim - 1) W[i + 1] = W[i] * cur_root;<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043d\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b? \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0432 \u043d\u0430\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0448\u0430\u0433\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u043a\u043e\u0440\u043d\u044f. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f(W[2]). \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043c\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0442 \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439, \u043d\u043e \u0441 \u0448\u0430\u0433\u043e\u043c 2. \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043d\u0430 i-\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u0448\u0430\u0433, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u0441\u0441\u0438\u0432 W, \u0440\u0430\u0432\u0435\u043d 2\u2071.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\">void _fft2d(     fft_type *__restrict__ V,     size_t N,     size_t rowsize,     fft_type *__restrict__ W,     int step   ) {   \/\/ \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 {   if (N == 1) return;   if (N == 2) { #define Y(y, x) (V[(y)*rowsize + (x)])     auto x00 = Y(0, 0);     auto x10 = Y(1, 0);     auto x01 = Y(0, 1);     auto x11 = Y(1, 1);     Y(0, 0) = x00 + x10 + x01 + x11;     Y(0, 1) = x00 + x10 - x01 - x11;     Y(1, 0) = x00 - x10 + x01 - x11;     Y(1, 1) = x00 - x10 - x01 + x11;     return;   }   \/\/ } \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439    int n = N >> 1;  #define X(y, x, i, j) (V[((y)*n + (i)) * rowsize + ((x)*n) + j]) #define params n, rowsize, W, (step &lt;&lt; 1)   _fft2d(&amp;X(0, 0, 0, 0), params);   _fft2d(&amp;X(0, 1, 0, 0), params);   _fft2d(&amp;X(1, 0, 0, 0), params);   _fft2d(&amp;X(1, 1, 0, 0), params);    for (int i = 0; i &lt; n; i++) {     for (int j = 0; j &lt; n; j++) {       auto x00 = X(0, 0, i, j);       auto x10 = X(1, 0, i, j) * W[step * i];       auto x01 = X(0, 1, i, j) * W[step * j];       auto x11 = X(1, 1, i, j) * W[step * (i + j)];       X(0, 0, i, j) = x00 + x10 + x01 + x11;       X(0, 1, i, j) = x00 + x10 - x01 - x11;       X(1, 0, i, j) = x00 - x10 + x01 - x11;       X(1, 1, i, j) = x00 - x10 - x01 + x11;     }   } } <\/code><\/pre>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u043c\u0435\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2014 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e, \u0440\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/p>\n<pre><code class=\"python\">void _plan(     fft_type *__restrict__ V,     size_t N,     size_t M,     size_t rowsize,     fft_type *__restrict__ W,     int step_i,     int step_j   ) {   \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b   if (N == M) _fft2d(V, N, rowsize, W, step_i);   \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f   else if (N > M) {     int n = N >> 1; #define Y(y, i, j) (V[((y)*n + (i)) * rowsize + j]) #define params n, M, rowsize, W, (step_i &lt;&lt; 1), step_j     _plan(&amp;Y(0, 0, 0), params);     _plan(&amp;Y(1, 0, 0), params);      forn (i, n) {       forn (j, M) {         auto y00 = Y(0, i, j);         auto y10 = Y(1, i, j) * W[i * step_i];         Y(0, i, j) = y00 + y10;         Y(1, i, j) = y00 - y10;       }     }   \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f   } else { \/* ...\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434... *\/ } }<\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e NumPy \u0432 \u0441\u0432\u043e\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0434 \u0411\u041f\u0424, \u0434\u043e\u0432\u043e\u0434\u044f \u0442\u0438\u043f\u044b \u0432 \u043d\u0435\u043c \u0434\u043e np.complex128; \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0433\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 10%. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u0440\u0430\u0444\u0438\u043a, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 NumPy:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\"><strong>\u0420\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\"><strong>\u0412\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b Numpy (\u0441)<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\"><strong>\u041d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f (\u0441)<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\"><strong>\u0411\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f (s)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c (\u0441)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">2048&#215;512<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0116<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0093<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0090<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0044<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">2048&#215;1024<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0301<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0217<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0186<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0068<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">2048&#215;2048<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0610<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0457<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0401<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0127<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">4096&#215;1024<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0680<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0455<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0396<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0173<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">4096&#215;2048<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.1306<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0958<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0810<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0299<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">4096&#215;4096<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.2669<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.1970<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.1730<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0539<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">8192&#215;2048<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.2891<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.2010<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.1728<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0687<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">8192&#215;4096<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.5679<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.4109<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.3493<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.1254<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">8192&#215;8192<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">1.3753<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.9414<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.8273<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.2651<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438<\/em><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a09\/8a7\/d23\/a098a7d23b04965b987b8f598994130a.png\" alt=\"\u0413\u0440\u0430\u0444\u0438\u043a \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438\" title=\"\u0413\u0440\u0430\u0444\u0438\u043a \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438\" width=\"555\" height=\"432\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a09\/8a7\/d23\/a098a7d23b04965b987b8f598994130a.png\"\/><\/p>\n<div><figcaption>\u0413\u0440\u0430\u0444\u0438\u043a \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u0432 \u043f\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 &#171;\u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b&#187; \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c NumPy. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u043b\u0438 \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e, \u0445\u043e\u0442\u044f \u043c\u044b \u0443\u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0438\u043b\u0438\u044f, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0430 \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432. \u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0438\u0436\u0435, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430:<\/p>\n<pre><code>pip3 install git+https:\/\/github.com\/2D-FFT-Project\/2d-fft<\/code><\/pre>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \ud83d\ude42<\/p>\n<p><a href=\"https:\/\/github.com\/2D-FFT-Project\/2d-fft\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c<\/a><\/p>\n<h4>\u0420\u0435\u0441\u0443\u0440\u0441\u044b<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/algorithmica.org\/ru\/fft\"><u>FFT, Algorithmica<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.semanticscholar.org\/paper\/Modification-of-a-two-dimensional-fast-Fourier-by-a-Noskov-Tutatchikov\/df322ced152e1c37e05a3a20c87aa5c40f347823\"><u>Two-dimensional fast Fourier transform: Butterfly in analog of Cooley-Tukey algorithm, by V. S. Tutatchikov for IEEE, 2016<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 OTUS <a href=\"https:\/\/otus.pw\/0q9y\/\">\u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a>. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0443\u0440\u043e\u043a\u0438 \u043f\u043e \u0432\u0441\u0435\u043c IT-\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c, \u0432\u0441\u0435 \u0442\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/otus.pw\/XMk3\/\">\u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/775888\/\"> https:\/\/habr.com\/ru\/articles\/775888\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0432\u0437\u043e\u0439\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 NumPy \u043d\u0430 \u0446\u0435\u043b\u044b\u0445 50% \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438<\/h4>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435 \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0439 \u043d\u0430\u0443\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0435\u0442\u0438\u044f. \u041e\u043d \u043d\u0430\u0448\u0435\u043b \u0448\u0438\u0440\u043e\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u2014 \u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 Instagram \u0434\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 MP3-\u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>\u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0440\u044f\u0434\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u0430\u0436\u0435 \u043d\u0435\u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u0438\u0437 NumPy. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c, \u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0438 \u0441\u0442\u0430\u0442\u044c\u0438 2015 \u0433\u043e\u0434\u0430 \u043c\u044b \u043e\u0431\u043e\u0448\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c NumPy \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0430\u0436 \u043d\u0430 30-60%. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u044d\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0441\u043b\u0430\u0431\u043e\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435.<\/p>\n<p>\u041f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u044b\u0439 NumPy, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u0411\u041f\u0424 (FFT) \u043a \u0434\u0432\u0443\u043c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>\u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432 2015 \u0433\u043e\u0434\u0443 \u0434\u0432\u043e\u0435 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0443\u0447\u0435\u043d\u044b\u0445 <a href=\"https:\/\/link.springer.com\/article\/10.1134\/S1054661815010137\"><u>\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0438<\/u><\/a> \u0441\u0432\u043e\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0438\u0434\u0435\u044e \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0431\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0438\u0445 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0432 \u0435\u0435 \u043f\u0430\u0440\u043e\u0447\u043a\u043e\u0439 \u0441\u0432\u043e\u0438\u0445 \u0438\u0434\u0435\u0439.<\/p>\n<figure class=\"\">\n<div><figcaption>M.\u0412. \u041d\u043e\u0441\u043a\u043e\u0432, \u0430\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0432 \u043d\u0430\u0438\u0432\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438, \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"python\">void _fft2d( \/* \u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 N *\/ ) {   \/\/ \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 {   if (N == 1) return;   \/\/ } \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439     int n = N >> 1;        \/* \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 {      ...\u0417\u0434\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f 4 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446\u044b...        \/\/ X(x, y, i, j)   \/\/ x, y -- \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c   \/\/ i, j -- \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0434\u043c\u0430\u0442\u0440\u0438\u0446\u0435     _fft2d(&amp;X(0, 0), root * root, ...);   _fft2d(&amp;X(0, 1), root * root, ...);   _fft2d(&amp;X(1, 0), root * root, ...);   _fft2d(&amp;X(1, 1), root * root, ...);   } \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 *\/    for (int i = 0; i &lt; n; i++) {     for (int j = 0; j &lt; n; j++) {       auto x00 = X(0, 0, i, j);       auto x10 = X(1, 0, i, j) * \/* W[i] *\/;       auto x01 = X(0, 1, i, j) * \/* W[j] *\/;       auto x11 = X(1, 1, i, j) * \/* W[i] * W[j] *\/;       X(0, 0, i, j) = x00 + x10 + x01 + x11;       X(0, 1, i, j) = x00 + x10 - x01 - x11;       X(1, 0, i, j) = x00 - x10 + x01 - x11;       X(1, 1, i, j) = x00 - x10 - x01 + x11;     }   } }<\/code><\/pre>\n<p>\u041b\u044e\u0431\u043e\u0439 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u043f\u0443\u0442\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f. \u0412\u043e\u0442 \u043a\u0430\u043a \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043c\u044b:<\/p>\n<pre><code class=\"python\">void _fft2d( \/* \u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 N *\/ ) {   \/\/ \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 {   if (N == 1) return;   if (N == 2) { #define Y(y, x) (V[(y)*rowsize + (x)])     auto x00 = Y(0, 0);     auto x10 = Y(1, 0);     auto x01 = Y(0, 1);     auto x11 = Y(1, 1);     Y(0, 0) = x00 + x10 + x01 + x11;     Y(0, 1) = x00 + x10 - x01 - x11;     Y(1, 0) = x00 - x10 + x01 - x11;     Y(1, 1) = x00 - x10 - x01 + x11;     return;   }   \/\/ } \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439     \/\/ ... }<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0448\u0430\u0433 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u043c \u0448\u0430\u0433\u0435 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/algorithmica.org\/ru\/fft\"><u>algorithmica<\/u><\/a>, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0432 \u0435\u0435 \u0434\u043b\u044f \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0414\u0430\u043d\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u043a\u044d\u0448\u0443.<\/p>\n<pre><code class=\"python\">\/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f rev_bits[n] auto revbits = [](size_t *v, size_t n) {   int lg_n = log2(n);   forn(i, n) {     int revi = 0;     forn(l, lg_n) revi |= ((i >> l) &amp; 1) &lt;&lt; (lg_n - l - 1);     v[i] = revi;   } };  size_t *rev_n = new size_t[N], *rev_m = new size_t[M]; revbits(rev_n, N), revbits(rev_m, M);    \/\/ \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 forn(i, N) {   int rev_i = rev_n[i];   forn(j, M) {     if ((i &lt; rev_i) || ((i == rev_i) &amp;&amp; (j &lt; rev_m[j])))       std::swap(V[i * M + j], V[rev_i * M + rev_m[j]]);   } }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0445 \u043a\u043e\u0440\u043d\u0435\u0439 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446\u044b:<\/p>\n<pre><code class=\"python\">int mxdim = std::max(N, M); const int lg_dim = log2(mxdim); auto W = new fft_type[mxdim]; auto rooti = std::polar(1., (inverse ? 2 : -2) * fft::pi \/ mxdim);  \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u043d\u0435\u0439 auto cur_root = rooti; W[0] = 1; forn (i, mxdim - 1) W[i + 1] = W[i] * cur_root;<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043d\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b? \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0432 \u043d\u0430\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0448\u0430\u0433\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u043a\u043e\u0440\u043d\u044f. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f(W[2]). \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u043c\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0442 \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439, \u043d\u043e \u0441 \u0448\u0430\u0433\u043e\u043c 2. \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043d\u0430 i-\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0438 \u0448\u0430\u0433, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u0441\u0441\u0438\u0432 W, \u0440\u0430\u0432\u0435\u043d 2\u2071.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\">void _fft2d(     fft_type *__restrict__ V,     size_t N,     size_t rowsize,     fft_type *__restrict__ W,     int step   ) {   \/\/ \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 {   if (N == 1) return;   if (N == 2) { #define Y(y, x) (V[(y)*rowsize + (x)])     auto x00 = Y(0, 0);     auto x10 = Y(1, 0);     auto x01 = Y(0, 1);     auto x11 = Y(1, 1);     Y(0, 0) = x00 + x10 + x01 + x11;     Y(0, 1) = x00 + x10 - x01 - x11;     Y(1, 0) = x00 - x10 + x01 - x11;     Y(1, 1) = x00 - x10 - x01 + x11;     return;   }   \/\/ } \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439    int n = N >> 1;  #define X(y, x, i, j) (V[((y)*n + (i)) * rowsize + ((x)*n) + j]) #define params n, rowsize, W, (step &lt;&lt; 1)   _fft2d(&amp;X(0, 0, 0, 0), params);   _fft2d(&amp;X(0, 1, 0, 0), params);   _fft2d(&amp;X(1, 0, 0, 0), params);   _fft2d(&amp;X(1, 1, 0, 0), params);    for (int i = 0; i &lt; n; i++) {     for (int j = 0; j &lt; n; j++) {       auto x00 = X(0, 0, i, j);       auto x10 = X(1, 0, i, j) * W[step * i];       auto x01 = X(0, 1, i, j) * W[step * j];       auto x11 = X(1, 1, i, j) * W[step * (i + j)];       X(0, 0, i, j) = x00 + x10 + x01 + x11;       X(0, 1, i, j) = x00 + x10 - x01 - x11;       X(1, 0, i, j) = x00 - x10 + x01 - x11;       X(1, 1, i, j) = x00 - x10 - x01 + x11;     }   } } <\/code><\/pre>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u043c\u0435\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2014 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e, \u0440\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b:<\/p>\n<pre><code class=\"python\">void _plan(     fft_type *__restrict__ V,     size_t N,     size_t M,     size_t rowsize,     fft_type *__restrict__ W,     int step_i,     int step_j   ) {   \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b   if (N == M) _fft2d(V, N, rowsize, W, step_i);   \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f   else if (N > M) {     int n = N >> 1; #define Y(y, i, j) (V[((y)*n + (i)) * rowsize + j]) #define params n, M, rowsize, W, (step_i &lt;&lt; 1), step_j     _plan(&amp;Y(0, 0, 0), params);     _plan(&amp;Y(1, 0, 0), params);      forn (i, n) {       forn (j, M) {         auto y00 = Y(0, i, j);         auto y10 = Y(1, i, j) * W[i * step_i];         Y(0, i, j) = y00 + y10;         Y(1, i, j) = y00 - y10;       }     }   \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f   } else { \/* ...\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434... *\/ } }<\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e NumPy \u0432 \u0441\u0432\u043e\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0434 \u0411\u041f\u0424, \u0434\u043e\u0432\u043e\u0434\u044f \u0442\u0438\u043f\u044b \u0432 \u043d\u0435\u043c \u0434\u043e np.complex128; \u0435\u0441\u043b\u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0433\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 10%. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u0440\u0430\u0444\u0438\u043a, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 NumPy:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\"><strong>\u0420\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\"><strong>\u0412\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b Numpy (\u0441)<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\"><strong>\u041d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f (\u0441)<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\"><strong>\u0411\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f (s)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c (\u0441)<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">2048&#215;512<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0116<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0093<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0090<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0044<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">2048&#215;1024<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0301<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0217<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0186<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0068<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">2048&#215;2048<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0610<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0457<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0401<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0127<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">4096&#215;1024<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.0680<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0455<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0396<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0173<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">4096&#215;2048<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.1306<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.0958<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.0810<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0299<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">4096&#215;4096<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.2669<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.1970<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.1730<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0539<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">8192&#215;2048<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.2891<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.2010<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.1728<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0687<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">8192&#215;4096<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">0.5679<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.4109<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.3493<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.1254<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"89\" width=\"89\">\n<p align=\"left\">8192&#215;8192<\/p>\n<\/td>\n<td data-colwidth=\"119\" width=\"119\">\n<p align=\"left\">1.3753<\/p>\n<\/td>\n<td data-colwidth=\"129\" width=\"129\">\n<p align=\"left\">0.9414<\/p>\n<\/td>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">0.8273<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.2651<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438<\/em><\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0413\u0440\u0430\u0444\u0438\u043a \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u0432 \u043f\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 &#171;\u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b&#187; \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c NumPy. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u043b\u0438 \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e, \u0445\u043e\u0442\u044f \u043c\u044b \u0443\u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0438\u043b\u0438\u044f, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0430 \u043f\u0443\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432. \u0426\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u0432 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0438\u0436\u0435, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430:<\/p>\n<pre><code>pip3 install git+https:\/\/github.com\/2D-FFT-Project\/2d-fft<\/code><\/pre>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \ud83d\ude42<\/p>\n<p><a href=\"https:\/\/github.com\/2D-FFT-Project\/2d-fft\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c<\/a><\/p>\n<h4>\u0420\u0435\u0441\u0443\u0440\u0441\u044b<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/algorithmica.org\/ru\/fft\"><u>FFT, Algorithmica<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.semanticscholar.org\/paper\/Modification-of-a-two-dimensional-fast-Fourier-by-a-Noskov-Tutatchikov\/df322ced152e1c37e05a3a20c87aa5c40f347823\"><u>Two-dimensional fast Fourier transform: Butterfly in analog of Cooley-Tukey algorithm, by V. S. Tutatchikov for IEEE, 2016<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 \u043a\u0443\u0440\u0441\u0430 OTUS <a href=\"https:\/\/otus.pw\/0q9y\/\">\u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a>. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u043e\u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0443\u0440\u043e\u043a\u0438 \u043f\u043e \u0432\u0441\u0435\u043c IT-\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c, \u0432\u0441\u0435 \u0442\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/otus.pw\/XMk3\/\">\u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/775888\/\"> https:\/\/habr.com\/ru\/articles\/775888\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-360994","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360994"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360994\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}