Não tem "enrolação" nenhuma (em QFD - quantum field dynamics), é bem simples por sinal.
por ex, tu tem uma DFT, dai tu vai implementar em um computador quantico. (DFT obviamente é https://en.wikipedia.org/wiki/Discrete_Fourier_transform)
Assim https://en.wikipedia.org/wiki/Quantum_Fourier_transform
QFT : |X> -> 1/sqr(N) \sum_0^{N-1} w_x^k |K>
Dai tu precisa saber sobre quantum gates para implementar o programa acima.
Primeiro, vamos usar uma transformação elementar para matrices (se tu aprender Algebra Linear, é bem facil)
F_N = 1/SQR(N) / {w_n^(N-1)}) "/" is the diadic operator for array intersperse (learn APL https://en.wikipedia.org/wiki/APL_syntax_and_symbols)
Dai tu pega Hamard transformation https://en.wikipedia.org/wiki/Hadamard_transform
Hm = 1/SQR(2) "/" ( H_(m-1) ) "m" is a complex number, again, APL pseudo syntax.
Perceba, que da mesma forma que tu implementa um DFT em APL desta forma.
FFT ← { ⍺ = 1 : ⍵ f ← * (⍟¯1) × ¯2 × k÷N T ← X ⍴⍨ 2 ,⍨ N÷2 EvenOdd ← ∇ ¨ ∪ ⌿ T Y1 ← {⍺ + f × ⍵} / EvenOdd Y2 ← {⍺ - f × ⍵} / EvenOdd (⍺-1)∇ ⍺⍺ ⍵ }
⍝ todas as variaveis acima são numeros complexos ou arrays deles
[PART I/II]
Agora que eu defini o que eu quero fazer, vamos transformar para um algoritimo quantico.
Part II/II
Para conseguir entender melhor, ler este paper https://www.microsoft.com/en-us/research/uploads/prod/2016/11/Fast-Signal-Transforms-for-Quantum-Computers.pdf
DFT 2^n = [ DFT 2^(n-1) ; DFT 2^(n-1) ; DFT 2^(n-1) W_n ; DFT 2^(n-1) W_n ]
Usando uma notação de Tensores é mais facil de entender.
T_n = 1_(2^(n-1) \plus ( 1 "/" {w_n^(N-1)} ) \xor ( 1 w_(2^n) )
Agora só aplicar o Shor algorithm. (II) F_y(x) = y^x mod N (quem aprendeu RSA vai conhecer esta parte)
Lemma 2
choose random y such as (y, N) = 1 |0> \xor |0> [log_2 N]
Let N^2 < Q < 2N^2
Now we apply our DFT.
(I) 1/SQR(Q) \sum_0^(Q-1) |x> \xor |0>
Calculating (I) on (II) gives use F_y(x) = y^x mod N \sum_(y^x=z_0) |x> |z_0> = \sum_(k=0)^Q over 1 |x_0 + kr> where y^x_0 = z_0
There it is !!!1!! profit !
\sum \euler^(2 \pi i x_0 l / r) |l (Q/r)> |z0>
Terminado com a parte matematica.
[Parte III/III]
Lendo aqui https://docs.microsoft.com/en-us/quantum/concepts/software-stack?view=qsharp-preview
Perceba como a Hadamard transform é feita por DFTs https://en.wikipedia.org/wiki/Fast_Walsh%E2%80%93Hadamard_transform
Theorema 3 , yes, I forgot, prepare for more Math.
( \phi \up \t G )^B \shor_function _(i=0)^(p-1) \lambda i * [| p_n |]
I didn't understand very well the decomposition, but we don't want any proof, mathematicians put it in the paper, so let's use it at face value.
This is what we want to do, there's a simulation. https://demonstrations.wolfram.com/QuantumFourierTransformCircuit/
Aquele R elucidante é o controlled rotation https://en.wikipedia.org/wiki/Quantum_logic_gate#Phase_shift_gates This thing !!!!!!!!!!! https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.r1frac?view=qsharp-preview
Looking at the (Fig. 1), podemos implementer this way: ''' operation QFT (a : Int, qs : BigEndian) : Unit { body (...) { for (i in 0 .. nQubits - 1) { for (j in 0 .. i - 1) { if (i - j < a) { Controlled R1Frac([(qs!)[i]], (1, i - j, (qs!)[j])); //apply R1 rotation over all the other inputs } } H((qs!)[i]); // the Hadamard_transform }
I also had to read this https://arxiv.org/pdf/quant-ph/0403071.pdf
A vantagem toda é que o algoritimo de DFT em computadores classicos é O(N log N), enquanto em computadores quanticos é só O(log2 N) quasi-linear !!!!
Perceba tambem como estes varios W_n não passam de matrizes de pesos, e podem ser usados para implementar redes neurais tambem !
Provavelmente não tem aplicação direta para meros mortais programadores, mas é util para fazer libraries low leval para optimização.
DFT é utilizado para coisas uteis.
https://www.dspguide.com/ch9.htm (minha implementação em APL eu fiz baseado nisto)
por ex, Analysis Spectral de Sinais https://www.youtube.com/watch?v=YarJ90H2ahA
Final code:
operation QFT (a : Int, qs : BigEndian) : Unit { body (...) {
for (i in 0 .. nQubits - 1) { for (j in 0 .. i - 1) {
if (i - j < a) {
//apply R1 rotation over all the other inputs
Controlled R1Frac([(qs!)[i]], (1, i - j, (qs!)[j]));
}}
// the Hadamard_transform
H((qs!)[i]);
}