I was trying to initialize to an arbitrary state of n qubits with the initialize()
from Qiskit but it doesn't generate a state with the same amplitudes passed as an argument, instead, it creates a state that when compared to the wanted state will have fidelity equals $1$. (described here)
My question is: Is there any method that can generate a state that will have numerically same wanted amplitudes ?
Edit: Just found the PrepareArbitraryState in Q# that does the same thing, they are based in the same paper but some results seen different between then. If someone could explain me the technical differences between then it will be perfect.
Edit(2): Here is the test cited in the Qiskit tutorial:
$\left|\psi\right\rangle = \frac{i}{4}\left|000\right\rangle + \frac{1}{\sqrt{8}}\left|001\right\rangle + \frac{1+i}{4}\left|010\right\rangle + \frac{1+2i}{\sqrt{8}}\left|101\right\rangle + \frac{1}{4}\left|110\right\rangle$
Applied to Q# (this result is the same as input and is what I want):
|0⟩ 5.970914908063292E-17 + 0.25000000000000017𝑖
|1⟩ 0.3535533905932739 + 3.251767952832691E-17𝑖
|2⟩ 0.2500000000000002 + 0.25000000000000017𝑖
|3⟩ -2.4061305817955694E-17 + -4.7860913024955035E-18𝑖
|4⟩ -4.845288669732255E-17 + 1.506300336842906E-16𝑖
|5⟩ 0.3535533905932743 + 0.7071067811865478𝑖
|6⟩ 0.2500000000000002 + -7.897235558417238E-17𝑖
|7⟩ 4.7022165029227935E-18 + -4.194489669218219E-17𝑖
Applied to Qiskit (same as the cited tutorial, have fidelity(input, output) = 1, but it doesn't match with the Q# result and it is not what I want):
|0⟩ 2.50000000e-01 + 0.j
|1⟩ 2.77555756e-17 - 0.35355339j,
|2⟩ 2.50000000e-01 - 0.25j
|3⟩ 0.00000000e+00 + 0.j
|4⟩ 0.00000000e+00 + 0.j
|5⟩ 7.07106781e-01 - 0.35355339j
|6⟩ 5.89805982e-17 - 0.25j
|7⟩ 0.00000000e+00 + 0.j