Intention - To learn and apply QFT on time-series data and compare the result with classical FFT.

Data Used - Small timeseries data of 16 points -

    669., 589.95, 659.9, 998.85, 690.8, 390.75, 633.7, 457.65, 581.6,
    662.55, 1105.5, 1237.45, 537.4, 464.35, 685.3, 499.25

Detrended the linear component and used the residual data for my experiment. Encoded the values as amplitudes of the 16 basis states -

def get_quantum_amplitude(signal):
    sum_squared_signal =  sum(signal**2)
    divider = np.sqrt(sum_squared_signal)
    amplitude_values = signal/divider
    no_of_qubit = np.log2(signal.size),
    return int(no_of_qubit[0]), amplitude_values, divider

no_of_qubit, amplitude_values, divider = get_quantum_amplitude(x_notrend)
amplitude_values,no_of_qubit, divider

qc = QuantumCircuit(no_of_qubit)
qft_circuit = QFT(no_of_qubit)
qc.initialize( amplitude_values, [i for i in reversed(qc.qubits)])
qc = qc.compose(qft_circuit, [0,1,2,3])

Now if I consider - the resultant state-vectors multiplied by the divider (mentioned above used for converting to normalized amplitudes) of the above circuit as the quantum Fourier transform values and compare it with the classical FFT output values(fft_vals = fft.fft(sample)) of the same signal, I see there is a mismatch.

But, if I multiply the Quantum FFT output value with the number of qubits (4 in this case) it is matching with the classical FFT values. Can anybody explain this behaviour?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.