OpenQL icon indicating copy to clipboard operation
OpenQL copied to clipboard

Bug Report: unitary decomposition fails to preserve phases

Open DevelopDaily opened this issue 4 years ago • 2 comments

Here is a simple unitary matrix:

(0.707107,0)    (0,0)        (0.707107,0)     (0,0) 
(0,0)           (0.5,0.5)    (0,0)            (0.5,0.5) 
(0.707107,0)    (0,0)        (-0.707107,0)    (0,0) 
(0,0)           (0.5,0.5)    (0,0)            (-0.5,-0.5) 

Apply the matrix to |0>, and you will get (0.707107, 0, 0.707107, 0)^T.

Apply the gates generated by the unitary class to the same state |0>, you will not get the same result.

DevelopDaily avatar Jan 24 '21 22:01 DevelopDaily

QX gives me

  [p = +0.4999980]  (+0.6532819,-0.2705933) |00> +
  [p = +0.5000020]  (+0.6532845,-0.2705944) |10> +

when applying the sequence of gates produced by decomposition on 29fc44d (which is surely equivalent to the current develop branch in terms of unitary decomposition) to |00>. I'm not really a quantum guy, but to me that looks like it differs only in global phase to what you got, which cannot be observed by measurement or manipulated by gates (and depends on how you define the rz/ry gates). So this doesn't look like a bug to me.

jvanstraten avatar Feb 10 '21 14:02 jvanstraten

Your statement is partially correct. In a lot of applications, the global phase can be indeed ignored for the reason as you stated.

But, for one of the most important quantum algorithms - Quantum Phase Estimation, the whole thing is about the phase. The current implementation of the unitary decomposition in the OpenQL is unable to support any quantum phase estimation applications.

DevelopDaily avatar Feb 12 '21 02:02 DevelopDaily