{"id":300501,"date":"2020-03-21T15:00:14","date_gmt":"2020-03-21T15:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=300501"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=300501","title":{"rendered":"Julia \u0438 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/493380\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k3\/er\/5f\/k3er5fawrdg-ut5fw9joizgsuja.png\"><\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c <a href=\"https:\/\/yaoquantum.org\" rel=\"nofollow\">Yao<\/a> (<a href=\"https:\/\/arxiv.org\/abs\/1912.10877\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>), \u043f\u0430\u043a\u0435\u0442 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c Julia \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0418\u043c\u044f Yao \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u043e\u0433\u043e \u0438\u0435\u0440\u043e\u0433\u043b\u0438\u0444\u0430, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0443\u043d\u0438\u0442\u0430\u0440\u043d\u043e\u0441\u0442\u044c (\u5e7a\u6b63).<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2r\/zl\/tn\/2rzltnjc0i8x49o7oc1vycvijru.png\"><\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0447\u0435\u043c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 Yao? \u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u044b \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u0436\u0430\u0434\u043d\u044b\u0435, \u043a\u0430\u043a \u0438 \u0442\u0435 \u0440\u0435\u0431\u044f\u0442\u0430, \u0447\u0442\u043e <a href=\"https:\/\/julialang.org\/blog\/2012\/02\/why-we-created-julia\/\" rel=\"nofollow\">\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u044f\u0437\u044b\u043a Julia<\/a>. \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0442\u0430\u043a\u0438\u0445 \u0448\u0442\u0443\u043a, \u043a\u0430\u043a:<\/p>\n<p>  <\/p>\n<h3 id=\"differenciruemost\">\u0414\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0431\u043b\u043e\u0433\u0435 Julia (\u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 <a href=\"https:\/\/arxiv.org\/abs\/1907.07587\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435 \u043e Zygote<\/a>), \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u043a\u0430\u043a\u0438\u0432\u0430\u0435\u0442 \u043c\u044b\u0441\u043b\u044c, \u0447\u0442\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b \u0438\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c, \u0447\u0435\u043c \u043b\u044e\u0434\u0438. \u0412 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445 \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0435\u043d\u0442\u0438\u043b\u0435\u0439 \u0438 \u0442.\u0434. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u043c\u0435\u0442\u044c <a href=\"https:\/\/habr.com\/post\/459562\/\">\u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a> \u0438 \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0441\u0445\u0435\u043c\u0430\u0445!<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (AD) \u0434\u043b\u044f \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0441\u0445\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c: \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0445\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0447\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0438\u0437-\u0437\u0430 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0432 \u043e\u0431\u0449\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435. \u0410 \u0432 \u043f\u0440\u044f\u043c\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 AD \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u2013 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 Yao \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u043c\u044b \u0432\u043d\u0435\u0434\u0440\u0438\u043b\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 <strong>\u0434\u043e\u043c\u0435\u043d\u043d\u043e-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439<\/strong> \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (AD), \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0443\u044e \u043f\u0440\u0438\u0440\u043e\u0434\u0443 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0441\u0445\u0435\u043c. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e AD \u0434\u0432\u0438\u0436\u043a\u0430 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">n, d = 16, 100 circuit = dispatch!(variational_circuit(n, d),:random); h = heisenberg(n)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"julia\">@time for i in 1:100      _, grad = expect'(h, zero_state(n) =&gt; circuit)      dispatch!(-, circuit, 1e-1 * grad)      println(&quot;Step $i, energy = $(real.(expect(h, zero_state(n)=&gt;circuit)))&quot;) end<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0443\u0447\u0430\u0435\u0442 100-\u0441\u043b\u043e\u0439\u043d\u0443\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 (4816 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432), \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 16-\u0443\u0437\u043b\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0413\u0435\u0439\u0437\u0435\u043d\u0431\u0435\u0440\u0433\u0430. \u0414\u0432\u0438\u0436\u043e\u043a \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u043e\u0431\u0449\u0435\u0439 AD \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a <a href=\"https:\/\/github.com\/FluxML\/Zygote.jl\" rel=\"nofollow\">Zygote<\/a>, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <a href=\"https:\/\/github.com\/QuantumBFS\/QuAlgorithmZoo.jl\/blob\/v0.1.0\/examples\/PortZygote\/gate_learning.jl\" rel=\"nofollow\">\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0433\u0435\u0439\u0442\u0430 (\u0432\u0435\u043d\u0442\u0438\u043b\u044f)<\/a>. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u043d\u0438\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c <a href=\"https:\/\/tutorials.yaoquantum.org\/dev\/\" rel=\"nofollow\">\u0443\u0447\u0435\u0431\u043d\u0438\u043a\u0435<\/a> \u0438 <a href=\"https:\/\/github.com\/QuantumBFS\/QuAlgorithmZoo.jl\" rel=\"nofollow\">\u0437\u043e\u043e\u043f\u0430\u0440\u043a\u0435 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"rasshiryaemost\">\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e\u0441\u0442\u044c<\/h3>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u044b\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0438\u0434\u0435\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441. \u0422\u043e \u0436\u0435 \u043f\u043e\u043b\u0435 \u0441\u043e\u0444\u0442\u0430 \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445 \u043f\u043b\u043e\u0434\u043e\u043d\u043e\u0441\u0438\u0442 \u0441\u043e \u0432\u0441\u0435 \u043d\u0430\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0435\u0439 \u0441\u0438\u043b\u043e\u0439. \u041c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u0438\u0431\u043a\u043e\u0439 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0435\u0435 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e-\u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (\u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430, QBIR) \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u0445\u0435\u043c\u0430\u043c\u0438 \u0438 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432. \u042d\u0442\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c Yao \u0434\u043e \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e, \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u0441\u0430\u043c\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u043c\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c \u043d\u0430\u0448 \u0431\u044d\u043a\u044d\u043d\u0434 CUDA \u0432 <a href=\"https:\/\/github.com\/QuantumBFS\/CuYao.jl\" rel=\"nofollow\">CuYao<\/a> \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0440\u043e\u0434\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 Julia \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/arxiv.org\/abs\/1712.03112\" rel=\"nofollow\">CUDAnative<\/a>. \u0421 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u0430\u0442\u0447\u0430\u043c\u0438 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u0430\u0445\u0430\u0440\u043e\u043c Yao \u0437\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0434\u0432\u0438\u0436\u043a\u043e\u043c <a href=\"https:\/\/github.com\/symengine\/SymEngine.jl\" rel=\"nofollow\">SymEngine<\/a>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0441\u0445\u0435\u043c\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0432 Julia, \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c Yao \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u043c \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b. \u041f\u0430\u043a\u0435\u0442 Yao (\u0438\u043b\u0438 \u0435\u0433\u043e CUDA-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 CuYao) \u2014 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043c\u0435\u0442\u0430-\u043f\u0430\u043a\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0432\u043e\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043b\u0435\u0433\u043a\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"effektivnost\">\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>  <\/p>\n<p>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0441\u043e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b. \u041f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u043b \u0441\u0430\u043c\u043e\u0439 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/devblogs.nvidia.com\/gpu-computing-julia-programming-language\/\" rel=\"nofollow\">\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435<\/a> \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, Yao \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u0441\u0430\u043c\u044b\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0441\u0445\u0435\u043c\u0430\u0445 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zw\/qi\/dz\/zwqidz-eswfvfjt1jz-98o_2dty.png\"><br \/>  <em>\u0411\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/Roger-luo\/quantum-benchmarks\/blob\/master\/RESULTS.md\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"chto-dalshe\">\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435?<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0434\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043e \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u043e \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f.<br \/>  \u041c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0445\u043e\u0442\u0438\u043c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/QuantumBFS\/YaoQASM.jl\" rel=\"nofollow\">OpenQASM<\/a>), \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (<a href=\"https:\/\/github.com\/QuantumBFS\/YaoIR.jl\" rel=\"nofollow\">YaoIR<\/a>), \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u0435\u043d\u0437\u043e\u0440\u043d\u044b\u0445 \u0441\u0435\u0442\u043e\u043a (\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 <a href=\"https:\/\/yaoquantum.org\/qbirplayground.html\" rel=\"nofollow\">\u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435<\/a>) \u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e!<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0435\u0442\u0430-\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u043e\u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 <a href=\"https:\/\/yaoquantum.org\/research\/\" rel=\"nofollow\">\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b<\/a>, \u043d\u0430\u043c \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u044e\u0434\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u044b \u0432 \u044d\u0442\u043e\u0439 \u0438\u0434\u0435\u0435, <a href=\"https:\/\/github.com\/QuantumBFS\/Yao.jl\/blob\/master\/CONTRIBUTING.md\" rel=\"nofollow\">\u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043a \u043d\u0430\u043c<\/a>, \u0438 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439!<\/p>\n<p>  <\/p>\n<blockquote><p><em>\u041a\u043e\u043d\u0435\u0446 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0437 <a href=\"https:\/\/julialang.org\/blog\/2019\/12\/yao-differentiable-quantum-programming\/#extensible\" rel=\"nofollow\">\u0431\u043b\u043e\u0433\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 Julia<\/a>.<\/em><\/p><\/blockquote>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u044d\u0442\u0443 \u043a\u0440\u0430\u0441\u043e\u0442\u0443 \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"julia\">] dev https:\/\/github.com\/QuantumBFS\/QuAlgorithmZoo.jl.git<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"julia\">using Pkg pkgs = [&quot;Plots&quot;, &quot;Flux&quot;, &quot;Yao&quot;, &quot;YaoExtensions&quot;, &quot;StatsBase&quot;, &quot;BitBasis&quot;, &quot;FFTW&quot;, &quot;SymEngine&quot;]  for p in pkgs     Pkg.add(p) end  using Yao, YaoExtensions, Plots, StatsBase<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3 id=\"gotovim-sostoyanie-grinbergera-horna-caylingera\">\u0413\u043e\u0442\u043e\u0432\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0413\u0440\u0438\u043d\u0431\u0435\u0440\u0433\u0435\u0440\u0430-\u0425\u043e\u0440\u043d\u0430-\u0426\u0430\u0439\u043b\u0438\u043d\u0433\u0435\u0440\u0430<\/h3>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/is\/ba\/po\/isbapowrambifahnuvclwvwte6o.png\"><\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state\" rel=\"nofollow\">GHZ<\/a> \u2014 \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u043c\u0435\u0440\u0435 \u0442\u0440\u0438 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0446 \u0438\u043b\u0438 \u043a\u0443\u0431\u0438\u0442\u044b). \u041a\u0441\u0442\u0430\u0442\u0438, \u0434\u043b\u044f \u044d\u043a\u0441\u043a\u0443\u0440\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u044f\u0434 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/321292\/\">\u0415\u0441\u0442\u044c \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/a> \u2014 \u043f\u043e\u0441\u0442 \u0441 \u043c\u044f\u0433\u043a\u0438\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0432 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0430\u043b\u0433\u0435\u0431\u0440\u0443 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439<\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/251085\/\">\u041a\u0432\u0430\u043d\u0442\u043e\u0432\u0430\u044f \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0430: \u0447\u0430\u0441\u0442\u044c 2<\/a> \u2014 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0439 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u0443\u0442\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u043c\u0438)<\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/microsoft\/blog\/351628\/\">\u041e\u0441\u043d\u043e\u0432\u044b \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439<\/a> \u2014 \u0431\u043b\u043e\u0433 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043c\u0435\u043b\u043a\u043e\u043c\u044f\u0433\u043a\u0438\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u044f\u0437\u044b\u043a Q#<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"http:\/\/spkurdyumov.ru\/uploads\/2017\/09\/kvantovye-vychisleniya-i-funkcionalnoe-programmirovanie.pdf\" rel=\"nofollow\">\u041a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a> \u2014 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u043e\u0441\u043e\u0431\u0438\u0435 \u0441 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c \u0444\u043e\u0440\u043c\u0443\u043b \u043e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c. \u041a\u043e\u0433\u043e-\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043f\u0443\u0433\u043d\u0443\u0442\u044c \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0438 \u043d\u0430 \u0445\u0430\u0441\u043a\u0435\u043b\u0435, \u043d\u043e \u0438\u0445 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e, \u0434\u0430 \u0438 \u0447\u0435\u043c \u043d\u0435 \u043f\u043e\u0432\u043e\u0434 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u044f\u0437\u044b\u043a, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u0437\u043e\u0440 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043f\u043e \u0442\u0435\u043c\u0435: \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043d\u0438\u0433\u0438, \u043a\u0443\u0440\u0441\u044b \u2014 \u0432\u0441\u0435, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f.<\/li>\n<li><em>\u041a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f<\/em> \u041c. \u041d\u0438\u043b\u044c\u0441\u0435\u043d, \u0418. \u0427\u0430\u043d\u0433 \u2014 \u0431\u0438\u0431\u043b\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u044d\u043f\u043e\u0445\u0438. \u0414\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u0438\u043a\u0431\u0435\u0437 \u0432 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0430\u043b\u0433\u0435\u0431\u0440\u0443, \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u0443\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u043a\u0443, \u0442\u0435\u043e\u0440\u0438\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438, \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043a \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u0432 \u0436\u0435\u043b\u0435\u0437\u0435. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0436\u0438\u0432\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c, \u0444\u043e\u0440\u043c\u0443\u043b \u0440\u043e\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0432\u043e\u043e\u0431\u0449\u0435\u043c, \u043a\u0440\u0430\u0439\u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u043a\u0442\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043d\u043e \u0438 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443.<\/li>\n<li><a href=\"https:\/\/aldebaran.ru\/author\/s_syisoev_s\/kniga_vvedenie_v_kvantovyie_vyichisleniya_kvan\/\" rel=\"nofollow\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u041a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0421. \u0421. \u0421\u044b\u0441\u043e\u0435\u0432<\/a> \u2014 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0441\u043e\u0431\u0438\u0435 \u0441 \u0440\u0430\u0437\u0431\u043e\u0440\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 (\u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d <a href=\"https:\/\/stepik.org\/course\/3248\" rel=\"nofollow\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0439 \u043a\u0443\u0440\u0441<\/a>).<\/li>\n<li><a href=\"https:\/\/algassert.com\/quirk#circuit=%7B&quot;cols&quot;:%5B%5B1,1,&quot;H&quot;%5D%5D%7D\" rel=\"nofollow\">Quirk<\/a> \u2014 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0441\u0445\u0435\u043c \u043e\u043d\u043b\u0430\u0439\u043d<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438 \u043e\u0431\u0449\u0438\u0439 \u0441\u043e\u0432\u0435\u0442 \u043f\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e: \u043b\u0443\u0447\u0448\u0435 \u0448\u0442\u0443\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043d\u0438\u0433, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u043a\u0443\u0440\u0441\u043e\u0432, \u0438 \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u044f\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u044f\u043c\u0438. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0432 IBM \u0432\u0430\u043c \u043d\u0435 \u0441\u0432\u0435\u0442\u0438\u0442, \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0434\u0430 \u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u0441\u044f\u043a\u0438\u0445 \u0434\u0435\u043c\u0435\u043d\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u043a\u0430 \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0443, \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u043e\u0440\u0430 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0441\u0445\u0435\u043c! \u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435, \u0440\u0435\u0446\u0435\u043f\u0442 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0413\u0425\u0426-\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b43\/63a\/df7\/b4363adf72f701657d6338fbeb86f9c3.svg\" alt=\"$ |\\mathrm {GHZ} \\rangle ={\\frac {1}{\\sqrt {d}}}\\sum _{i=0}^{d-1}|i\\rangle \\otimes \\cdots \\otimes |i\\rangle ={\\frac {1}{\\sqrt {d}}}(|0\\rangle \\otimes \\cdots \\otimes |0\\rangle +\\cdots +|d-1\\rangle \\otimes \\cdots \\otimes |d-1\\rangle ) $\" data-tex=\"display\"><\/math><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043a\u0443\u0431\u0438\u0442\u043e\u0432 \u0441\u0445\u0435\u043c\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0438\u0434<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c0\/lr\/2_\/c0lr2_adoy21rrvfzfkkzy_ycom.png\"><\/p>\n<p>  <\/p>\n<p>\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Yao:<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">circuit = chain(     4,     put(1=&gt;X),     repeat(H, 2:4),     control(2, 1=&gt;X),     control(4, 3=&gt;X),     control(3, 1=&gt;X),     control(4, 3=&gt;X),     repeat(H, 1:4), )<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"julia\">nqubits: 4 chain \u251c\u2500 put on (1) \u2502  \u2514\u2500 X gate \u251c\u2500 repeat on (2, 3, 4) \u2502  \u2514\u2500 H gate \u251c\u2500 control(2) \u2502  \u2514\u2500 (1,) X gate \u251c\u2500 control(4) \u2502  \u2514\u2500 (3,) X gate \u251c\u2500 control(3) \u2502  \u2514\u2500 (1,) X gate \u251c\u2500 control(4) \u2502  \u2514\u2500 (3,) X gate \u2514\u2500 repeat on (1, 2, 3, 4)    \u2514\u2500 H gate<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0451 \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0442\u0430\u043a \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0432\u043e\u0434 \u0441\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u043d\u0442\u0438\u043b\u044c X, \u043e\u043d \u0436\u0435 not-gate (\u043f\u0435\u0440\u0435\u0432\u043e\u0440\u043e\u0442 \u043d\u0430 \u0441\u0444\u0435\u0440\u0435 \u0411\u043b\u043e\u0445\u0430), \u043d\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u0446\u0435\u043f\u043b\u044f\u044e\u0442\u0441\u044f \u0410\u0434\u0430\u043c\u0430\u0440\u044b, \u0430 \u0434\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u043a\u0438\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Controlled_NOT_gate\" rel=\"nofollow\">cnot-\u0432\u0435\u043d\u0442\u0438\u043b\u0438<\/a>.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0443\u0431\u0438\u0442\u044b \u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f (\u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0435, \u0432\u0435\u0434\u044c \u0442\u0443\u0442 \u0446\u0430\u0440\u0438\u0442 \u0441\u043f\u043b\u043e\u0448\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430)<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">results = ArrayReg(bit&quot;0101&quot;) |&gt; circuit |&gt; r-&gt;measure(r, nshots=1000)  hist = fit(Histogram, Int.(results), 0:16) bar(hist.edges[1] .- 0.5, hist.weights, legend=:none)<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yl\/mx\/ft\/ylmxftxaohtqevqxykf4yajixi8.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u0435, \u0413\u0425\u0426-\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u043b\u043b\u0430\u043f\u0441\u0438\u0440\u0443\u0435\u0442 \u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/16a\/882\/119\/16a882119a7840dadf31966099361c5f.svg\" alt=\"$\\mid 0100 \\rangle$\" data-tex=\"inline\"><\/math> \u0438\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1c4\/6ef\/484\/1c46ef484c8d69a2c9f69edb5ce0c142.svg\" alt=\"$\\mid 1011 \\rangle$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  <\/p>\n<h3 id=\"kvantovoe-preobrazovanie-fure\">\u041a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435<\/h3>\n<p>  <\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430 \u0438\u0437 \u043c\u0438\u0440\u0430 \u0443\u043d\u0438\u0442\u0430\u0440\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u2014 \u044d\u0442\u043e \u041a\u041f\u0424:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d2e\/2c6\/5c5\/d2e2c65c5604a61f9df5f62fe7881760.svg\" alt=\"$ N = 2^n \\\\ QFT\\mid x \\rangle = \\frac{\\parallel x \\parallel }{2^{n\/2}}\\sum_{y=0}^{2^n-1} \\exp\\left( 2\\pi i \\frac{xy}{N} \\right) \\mid y \\rangle $\" data-tex=\"display\"><\/math><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oz\/ny\/gy\/oznygy_q7r9tw2prrhljijjesei.png\"><br \/>  <em>\u0441\u0445\u0435\u043c\u0430 \u0434\u043b\u044f \u0442\u0440\u0435\u0445 \u043a\u0443\u0431\u0438\u0442\u043e\u0432<\/em><\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/382\/c42\/84f\/382c4284f73ec73034dda018b9c609db.svg\" alt=\"$ R_k = \\begin{pmatrix} 1 &amp; 0\\\\ 0 &amp; e^{2\\pi i}\/2^k \\end{pmatrix} $\" data-tex=\"display\"><\/math><\/p>\n<p>  <\/p>\n<p>\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0444\u0430\u0437\u043e\u0432\u044b\u043c \u0441\u0434\u0432\u0438\u0433\u043e\u043c \u0433\u0435\u0439\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0424\u0443\u0440\u044c\u0435 (QFT) \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0434\u0432\u0430 \u0432\u0438\u0434\u0430 \u0431\u043b\u043e\u043a\u043e\u0432:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/om\/tr\/jg\/omtrjgxyd7quywsayj_vsa7i3ow.png\"><br \/>  <em>\u0434\u043b\u044f \u043f\u044f\u0442\u0438 \u043a\u0443\u0431\u0438\u0442\u043e\u0432<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0431\u043b\u043e\u043a <code>\u0410<\/code> \u0438 \u0431\u043b\u043e\u043a <code>B<\/code> (<code>A<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u043e\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f):<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">A(i, j) = control(i, j=&gt;shift(2\u03c0\/(1&lt;&lt;(i-j+1)))) R4 = A(4, 1)  # (n -&gt; control(n, 4, 1 =&gt; shift(0.39269908169872414)))<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435 \u0431\u043b\u043e\u043a, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>mat<\/code>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0445\u0435\u043c\u0443 \u0431\u043b\u043e\u043a\u0430 <code>A<\/code> \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0432\u0435\u043d\u0442\u0438\u043b\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9b1\/21e\/3d7\/9b121e3d740587895c1257c92530c77c.svg\" alt=\"$R_4$\" data-tex=\"inline\"><\/math>:<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">R4(5)  #nqubits: 5 #control(4) #\u2514\u2500 (1,) shift(0.39269908169872414)<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"julia\">mat(R4(5))<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"julia\">32\u00d732 LinearAlgebra.Diagonal{Complex{Float64},Array{Complex{Float64},1}}:  1.0+0.0im      \u22c5          \u22c5          \u22c5      \u2026      \u22c5              \u22c5               \u22c5      1.0+0.0im      \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5      1.0+0.0im      \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5      1.0+0.0im         \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5      \u2026      \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5      \u2026      \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5              \u22ee                                        \u22f1     \u22ee                               \u22c5          \u22c5          \u22c5          \u22c5      \u2026      \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5      \u2026      \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5              \u22c5               \u22c5          \u22c5          \u22c5          \u22c5      \u2026  1.0+0.0im          \u22c5               \u22c5          \u22c5          \u22c5          \u22c5             \u22c5      0.92388+0.382683im<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u0443\u0431\u0438\u0442\u0430\u0445 \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0433\u0435\u0439\u0442 \u0410\u0434\u0430\u043c\u0430\u0440\u0430 \u0432 <em>i<\/em>-\u0439 \u043a\u0443\u0431\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c <em>i<\/em>-\u0439 \u0431\u043b\u043e\u043a <code>B<\/code>. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0437\u0434\u0435\u0441\u044c \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u043a\u0443\u0431\u0438\u0442\u043e\u0432 <em>n<\/em>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0445 \u043e\u0442 <em>k<\/em>-\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0445\u0435\u043c\u0443, \u0441\u0432\u044f\u0437\u0430\u0432 \u0432\u0441\u0435 \u0431\u043b\u043e\u043a\u0438 <code>B<\/code> \u0432\u043c\u0435\u0441\u0442\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">B(n, k) = chain(n, j==k ? put(k=&gt;H) : A(j, k) for j in k:n)  qft(n) = chain(B(n, k) for k in 1:n) qft(4)<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"julia\">nqubits: 4 chain \u251c\u2500 chain \u2502  \u251c\u2500 put on (1) \u2502  \u2502  \u2514\u2500 H \u2502  \u251c\u2500 control(2) \u2502  \u2502  \u2514\u2500 (1,) shift(1.5707963267948966) \u2502  \u251c\u2500 control(3) \u2502  \u2502  \u2514\u2500 (1,) shift(0.7853981633974483) \u2502  \u2514\u2500 control(4) \u2502     \u2514\u2500 (1,) shift(0.39269908169872414) \u251c\u2500 chain \u2502  \u251c\u2500 put on (2) \u2502  \u2502  \u2514\u2500 H \u2502  \u251c\u2500 control(3) \u2502  \u2502  \u2514\u2500 (2,) shift(1.5707963267948966) \u2502  \u2514\u2500 control(4) \u2502     \u2514\u2500 (2,) shift(0.7853981633974483) \u251c\u2500 chain \u2502  \u251c\u2500 put on (3) \u2502  \u2502  \u2514\u2500 H \u2502  \u2514\u2500 control(4) \u2502     \u2514\u2500 (3,) shift(1.5707963267948966) \u2514\u2500 chain    \u2514\u2500 put on (4)       \u2514\u2500 H<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u0442\u0430\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043a\u0430\u043a <code>A<\/code> \u0438 <code>B<\/code> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0441\u0445\u0435\u043c\u044b, \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0441\u0445\u0435\u043c, \u0438\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0431\u043b\u043e\u043a \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0431\u043b\u043e\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ua\/79\/fk\/ua79fknpifqnhmtgklg4mrdk3_g.png\"><\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043a\u0430\u043a \u043f\u043e\u0434\u0442\u0438\u043f <code>PrimitiveBlock<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0431\u043b\u043e\u043a\u0438 <code>QFT<\/code>. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434\u0431\u043b\u043e\u043a\u0438, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434 <code>CompositeBlock<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">struct QFT{N} &lt;: PrimitiveBlock{N} end QFT(n::Int) = QFT{n}() # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0445\u0435\u043c\u0443 circuit2(::QFT{N}) where N = qft(N) # \u0438 \u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043f\u043e \u0441\u0445\u0435\u043c\u0435 YaoBlocks.mat(::Type{T}, x::QFT) where T = mat(T, circuit2(x)) YaoBlocks.print_block(io::IO, x::QFT{N}) where N = print(io, &quot;QFT($N)&quot;)  using FFTW, LinearAlgebra  function YaoBlocks.apply!(r::ArrayReg, x::QFT)     \u03b1 = sqrt(length(statevec(r)))     invorder!(r)     lmul!(\u03b1, ifft!(statevec(r)))     return r end<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u043b\u0438 <code>print_block<\/code> \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443, \u0438 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044e QFT \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0430\u0440\u043e\u0435 \u0434\u043e\u0431\u0440\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0424\u0443\u0440\u044c\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0443\u0441\u0442\u0438\u043c \u043f\u043e \u043f\u0440\u043e\u0432\u043e\u0434\u0430\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">r = rand_state(5) r1 = r |&gt; copy |&gt; QFT(5) r2 = r |&gt; copy |&gt; circuit2(QFT(5)) r1 \u2248 r2  # true<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6t\/y9\/wh\/6ty9whppyckdormd_olkszwlc8e.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"algoritm-shora\">\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0428\u043e\u0440\u0430<\/h3>\n<p>  <\/p>\n<p>\u0414\u0430, <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%D0%A8%D0%BE%D1%80%D0%B0\" rel=\"nofollow\">\u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0437\u043b\u043e\u043c\u0430\u0435\u0442 \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 <a href=\"http:\/\/www.michurin.net\/computer-science\/rsa.html\" rel=\"nofollow\">\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438<\/a>. \u0421\u0445\u0435\u043c\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vf\/x6\/yl\/vfx6ylz0pviwv9puagyvdhl0a2q.png\"><\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0428\u043e\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a <a href=\"https:\/\/algassert.com\/post\/1718\" rel=\"nofollow\">\u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u044b\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c<\/a> (\u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u043a\u043d\u0438\u0433 \u0438 \u043f\u043e\u0441\u043e\u0431\u0438\u0439). \u041d\u0430\u0448 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u0442 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e <code>L<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439. \u0417\u0434\u0435\u0441\u044c, \u0432\u0432\u043e\u0434 <code>ver<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e <code>Val(:quantum)<\/code> \u043b\u0438\u0431\u043e <code>Val(:classical)<\/code>, \u0447\u0442\u043e\u0431 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"julia\">using Yao, BitBasis using YaoExtensions: KMod, QFTCircuit using QuAlgorithmZoo: NumberTheory  function shor(L::Int, ver=Val(:quantum); maxtry=100)     L%2 == 0 &amp;&amp; return 2      # find short cut solutions like `a^b`     res = NumberTheory.factor_a_power_b(L)     res !== nothing &amp;&amp; return res[1]      for i in 1:maxtry         # step 1         x = NumberTheory.rand_primeto(L)          # step 2         r = get_order(ver, x, L; )         if r%2 == 0 &amp;&amp; powermod(x, r\u00f72, L) != L-1             # step 3             f1, f2 = gcd(powermod(x, r\u00f72, L)-1, L), gcd(powermod(x, r\u00f72, L)+1, L)             if f1!=1                 return f1             elseif f2!=1                 return f2             else                 error(&quot;Algorithm Fail!&quot;)             end         end     end end<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u0435 \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0448\u0430\u0433\u043e\u0432:<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u043b\u044f <code>L<\/code>, \u0442. \u0435. <code>gcd(x, L) == 1<\/code>. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u0430.<\/p>\n<p>  <\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a <em>x<\/em>, \u0442. \u0435. \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0447\u0438\u0441\u043b\u043e <em>r<\/em>, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0435\u0435 <code>mod(x^r, L) == 1<\/code>. \u0415\u0441\u043b\u0438 <em>r<\/em> \u0447\u0435\u0442\u043d\u043e, \u0430 <em>x^(r\u00f72)<\/em> \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \u0417\u0434\u0435\u0441\u044c \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435, \u044d\u0442\u043e \u0440\u0430\u0432\u043d\u043e\u0435 <code>L-1 (mod L)<\/code>.<\/p>\n<p>  <\/li>\n<li>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0442\u0435\u043e\u0440\u0435\u043c\u0435 5.2 \u0432 <a href=\"https:\/\/aapt.scitation.org\/doi\/abs\/10.1119\/1.1463744?journalCode=ajp\" rel=\"nofollow\">\u043a\u043d\u0438\u0433\u0435 \u041d\u0438\u043b\u044c\u0441\u0435\u043d\u0430<\/a>,<br \/>  \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 <code>gcd(x^(r\u00f72)-1, L)<\/code> \u0438 <code>gcd (x^(r\u00f72)+1, L)<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u043c (!=1) \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c L. \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <code>powermod(x, r\u00f72, L)<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d -1, \u0430 \u043d\u0435 1, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c <code>r\/2<\/code> \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hl\/p0\/o7\/hlp0o7uinhxgathiw2iqewv59ji.gif\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u2014 \u044d\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430. \u041c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432 <em>NumberTheory<\/em>, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0438\u0442\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443<\/li>\n<li>\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0431\u0438\u0442\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u043a\u0430\u043a \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e s \/ r. \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439, \u0430 \u0437\u0430\u0442\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0439 \u0434\u0440\u043e\u0431\u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0434\u043b\u044f \u043d\u0430\u0441 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432-\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <code>nshot<\/code>, <code>nbit<\/code> (\u0440\u0430\u0437\u043c\u0435\u0440 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445) \u0438 <code>ncbit<\/code> (\u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438\u043b\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430). <code>nbit<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a <code>ncbit<\/code> \u043c\u043e\u0436\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"julia\">&quot;&quot;&quot;\u043e\u0446\u0435\u043d\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430.&quot;&quot;&quot; estimate_ncbit(nbit::Int, \u03f5::Real) = 2*nbit + 1 + ceil(Int,log2(2+1\/2\u03f5))  get_order(::Val{:classical}, x::Int, L::Int; kwargs...) = NumberTheory.find_order(x, L) function get_order(::Val{:quantum}, x::Int, L::Int; nshots::Int=10,             nbit::Int=bit_length(L-1), ncbit::Int=estimate_ncbit(nbit, 0.25))     c = order_finding_circuit(x, L; nbit=nbit, ncbit=ncbit)     reg = join(product_state(nbit, 1), zero_state(ncbit))      res = measure(copy(reg) |&gt; c; nshots=nshots)     for r in res         # split bit string b into lower bits `k` and higher bits `r`.         mask = bmask(1:ncbit)         k,i = r&amp;mask, r&gt;&gt;ncbit         # get s\/r         \u03d5 = bfloat(k)  #         \u03d5 == 0 &amp;&amp; continue          # order_from_float: given a floating point number,         # return the closest rational number with bounded number of continued fraction steps.         order = NumberTheory.order_from_float(\u03d5, x, L)         if order === nothing             continue         else             return order         end     end     return nothing end<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><code>order_finding_circuit(x::Int, L::Int; nbit::Int=bit_length(L-1), ncbit::Int=estimate_ncbit(nbit, 0.25)) -&gt; AbstractBlock<\/code><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430 <code>x<\/code> \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a <code>L<\/code>,<br \/>  \u043f\u043e\u0434\u0430\u0432\u0430\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b <code>|1&gt;\u2297|0&gt;<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 &quot;\u0444\u0430\u0437\u043e\u0432\u043e\u0439&quot; \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<pre><code class=\"julia\">function order_finding_circuit(x::Int, L::Int; nbit::Int, ncbit::Int)     N = nbit+ncbit     chain(N, repeat(N, H, 1:ncbit), KMod{N, ncbit}(x, L),         subroutine(N, qft_circuit(ncbit)', 1:ncbit)) end<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0412\u0435\u043d\u0442\u0438\u043b\u0438 \u0410\u0434\u0430\u043c\u0430\u0440\u0430<\/li>\n<li><code>KMod<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>mod(a^k*x, L)<\/code>.<br \/>  <code>k<\/code> \u2014 \u044d\u0442\u043e \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0435\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u044b\u0445 <code>k<\/code> (\u0438\u043b\u0438 <code>ncbit<\/code>) \u043a\u0443\u0431\u0438\u0442\u0430\u0445, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 <code>N-K<\/code> \u043a\u0443\u0431\u0438\u0442\u044b \u0445\u0440\u0430\u043d\u044f\u0442 <code>a<\/code>. \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0433\u0435\u0439\u0442, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0431\u044b\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0432 Yao. \u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u043d\u0430 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0439 \u0441\u0445\u0435\u043c\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0440\u043e\u0447\u0442\u0438\u0442\u0435 <a href=\"https:\/\/arxiv.org\/abs\/1805.12445\" rel=\"nofollow\">\u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e<\/a>.<\/li>\n<li>\u041e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0424\u0443\u0440\u044c\u0435.<\/li>\n<\/ol>\n<p>  <\/p>\n<pre><code class=\"julia\">@time shor(35, Val(:quantum))  # 2.287219 seconds (14.37 k allocations: 113.341 MiB, 1.38% gc time) # 5<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"julia\">@time shor(35, Val(:classical)) # 0.000208 seconds (6 allocations: 224 bytes) # 5<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ls\/uv\/ot\/lsuvottnh-vvpuufp7aqrjxsje8.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"itog\">\u0418\u0442\u043e\u0433<\/h3>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043e\u0431\u043a\u0430\u0442\u0430\u043b\u0438 \u043c\u043e\u0449\u043d\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 <a href=\"http:\/\/tutorials.yaoquantum.org\/dev\/generated\/quick-start\/5.shor-9-code\/\" rel=\"nofollow\">\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438<\/a>: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u0442 \u0413\u0440\u043e\u0432\u0435\u0440\u0430, \u043c\u0430\u0448\u0438\u043d\u0430 \u0411\u043e\u0440\u043d\u0430, \u0434\u0435\u0432\u044f\u0442\u0438\u043a\u0443\u0431\u0438\u0442\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0442.\u0434. \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u044f\u0435\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u0435\u043a, \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 <a href=\"https:\/\/habr.com\/ru\/company\/microsoft\/blog\/440180\/\">\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u0430\u0445<\/a>. <\/p>\n<p>  <\/p>\n<p>\u0418 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u043c \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u0443\u044e \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u044e, \u043f\u043e\u0441\u0435\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0431\u044b\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/h-\/eo\/t2\/h-eot2yxg7litmcgelpvl5suuw8.jpeg\"><\/p>\n<\/div>\n<p> \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\/post\/493380\/\"> https:\/\/habr.com\/ru\/post\/493380\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/493380\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k3\/er\/5f\/k3er5fawrdg-ut5fw9joizgsuja.png\"><\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c <a href=\"https:\/\/yaoquantum.org\" rel=\"nofollow\">Yao<\/a> (<a href=\"https:\/\/arxiv.org\/abs\/1912.10877\" rel=\"nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>), \u043f\u0430\u043a\u0435\u0442 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c Julia \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043a\u0432\u0430\u043d\u0442\u043e\u0432\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u0418\u043c\u044f Yao \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u043e\u0433\u043e \u0438\u0435\u0440\u043e\u0433\u043b\u0438\u0444\u0430, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0443\u043d\u0438\u0442\u0430\u0440\u043d\u043e\u0441\u0442\u044c (\u5e7a\u6b63).<\/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-300501","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300501","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=300501"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/300501\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=300501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=300501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=300501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}