1
$\begingroup$

I am having a difficult time trying to extract an HHL matrix inversion solution from the full system statevector.

I have a 32x32 size matrix A and a 32x1 vector b, and I ran HHL on 13 qubits. HHL outputted the following circuit diagram:

enter image description here

Following the textbook, the solution vector would correspond to the ancilla qubit being in state $|1\rangle$, and all the interior work qubits being in state $|0\rangle$.

So do the correct vector components in this case correspond to the coefficients of $|1000000000000\rangle$ to $|1000000011111\rangle$? The solution vector has a full element count of $2^{13}=8192$. I've calculated these corresponding solution indices to be 4095:4128. However, in trying to extract this solution from the complete statevector I am getting completely erroneous results. Any help would be greatly appreciated!

$\endgroup$
1
  • $\begingroup$ Hi and welcome to Quantum Computing SE. Note that the solution gained in HHL algorithm is only similar to actual $|x\rangle$. Does ratios of elements in your "HHL solution" corespond to ratios in the expected solution? If so, you obtained correct results. $\endgroup$ Jan 4 at 21:44
1
$\begingroup$

You should compare the normalised classical solution to the normalised solution vector you compute from the Statevector. If the solution is still wrong it might be that you are using the wrong ordering of qubits, so maybe you have to take the reverse order with respect to what you were doing, i.e. $|0000000000001\rangle$ to $|1111100000001\rangle$

$\endgroup$
0
$\begingroup$

Sorry, just registered for an account so this is me trying to reply! Thank you both for your input.

So far I've tried to normalize the solution vector by the full 8192-element statevector 2-norm, is this correct? Or should I be normalizing it only by the 2-norm of the extracted 32-element solution vector?

Strangely either way, I'm still getting erroneous results, the ratio between the vectors are not constant as Martin suggested.

I also tried reversing the bit string as you suggested, so am now reading the indices 0:32 to represent |0000000000001⟩ to |1111100000001⟩.

$\endgroup$
1
  • $\begingroup$ Please use comments to discussion, not the answers. $\endgroup$ Jan 5 at 21:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.