qiskit-textbook icon indicating copy to clipboard operation
qiskit-textbook copied to clipboard

[4.1.1] A miscalculation in the HHL textbook

Open Kuma-quant opened this issue 4 years ago • 5 comments

Describe the issue

A miscalculation in the HHL textbook was found. I spent a lot of time on that xD

Solving Linear Systems of Equations using HHL

In sec. 3. (Example: 4-qubit HHL,),

image

These eigen vector would be wrong. The pair of eigen value and eigen vector is turned over ! Therefore,

  • The scaled eigen value of 1/2 corresponds to eigen vector of [1,-1], not [1,1].
  • The scaled eigen value of 1/4 corresponds to eigen vector of [1,1], not [1,-1].

image

The following calculation about 4-qubit HHL example is also wrong. Let us check numerically. image From the value of u1 and u2, we can easily show that the second element of solution x is negative.

However, exact (normalized) solution is x_exact = [0.9486833 0.31622777]. The second element of solution x is not negative but positive.

It also can be seen in Sec. 4-A as follows, image Again, the second element of solution x is positive.

Describe what you expect to see In In sec. 3. (Example: 4-qubit HHL,), the eigen vectos should be turned over. The scaled eigen value of 1/2 corresponds to eigen vector of [1,-1], not [1,1]. The scaled eigen value of 1/4 corresponds to eigen vector of [1,1], not [1,-1].

image

Kuma-quant avatar Jan 11 '21 09:01 Kuma-quant

I found the same bug. and still the probability exceeds 1!!!

mbuchberger1967 avatar Feb 04 '21 21:02 mbuchberger1967

I found the same bug. and still the probability exceeds 1!!!

Hi, Markus-san. I have found how the miscalculation of the probability was occured in the HHL textbook. (Issue 881) https://github.com/qiskit-community/qiskit-textbook/issues/881

Kuma-quant avatar Feb 09 '21 15:02 Kuma-quant

Hi, @frankharkins please assign #883 to amitracal

amitracal avatar Mar 25 '21 21:03 amitracal

@frankharkins : I'll look at this issue with Abhijit

hykavitha avatar Apr 01 '21 09:04 hykavitha

@hykavitha @amitracal this is possibly fixed in #1018, can you check please?

frankharkins avatar Apr 09 '21 17:04 frankharkins