Approximating unitary matrices












4














I currently have 2 unitary matrices that I want to approximate to a good precision with the fewer quantum gates possible.



In my case the two matrices are:




  • $$G = frac{-1}{sqrt{2}}begin{pmatrix} i & 1 \ 1 & i end{pmatrix}$$

  • $$W =
    begin{pmatrix}
    1&0&0&0\
    0&frac{1}{sqrt{2}}&frac{1}{sqrt{2}}&0\
    0&frac{1}{sqrt{2}}&frac{-1}{sqrt{2}}&0\
    0&0&0&1 \
    end{pmatrix}$$


My question is the following:




How can I approximate these specific matrices with the fewer quantum gates possible and a good precision?




What I want to have an can afford to have it:




  1. I can afford to use several days/weeks of CPU time and a lot of RAM.

  2. I can afford to spend 1 or 2 human days searching for mathematical tricks (in last resort, that is why I ask here first). This time does not include the time I would need to implement the hypothetical algorithms used for the first point.

  3. I want the decomposition to be nearly exact. I don't have a target precision at the moment, but the 2 gates above are used extensively by my circuit and I don't want errors to accumulate too much.

  4. I want the decomposition to use the fewest quantum gates possible. This point is secondary for the moment.

  5. A good method would let me choose the trade-off I want between the number of quantum gates and the precision of the approximation. If this is not possible, an accuracy of at least $10^{-6}$ (in terms of trace norm) is probably (as said before, I do not have estimates so I am not sure of this threshold) required.

  6. The gate set is:
    $$
    left{ H, X, Y, Z, R_phi, S, T, R_x, R_y, R_z, text{CX}, text{SWAP}, text{iSWAP}, sqrt{text{SWAP}} right}
    $$

    with $R_phi, text{SWAP}, sqrt{text{SWAP}}$ as described in Wikipédia, $R_A$ the rotation with respect to the axe $A$ ($A$ is either $X$, $Y$ or $Z$) and
    $$text{iSWAP} = begin{pmatrix} 1 & 0 & 0 & 0 \
    0 & 0 & i & 0 \
    0 & i & 0 & 0 \
    0 & 0 & 0 & 1 \ end{pmatrix}$$
    .


The methods I know about:




  1. The Solovay-Kitaev algorithm. I have an implementation of this algorithm and already tested it on several unitary matrices. The algorithm generates sequences that are quite long and the trade-off [number of quantum gates] VS [precision of the approximation] is not enough parametrisable. Nevertheless, I will execute the algorithm on these gates and edit this question with the results I obtained.

  2. Two papers on 1-qubit gate approximation and n-qubit gate approximation. I also need to test these algorithms.










share|improve this question
























  • Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    – Mithrandir24601
    5 hours ago






  • 1




    Edited to precise the gate-set I had in mind :)
    – Nelimee
    5 hours ago










  • Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    – Norbert Schuch
    2 hours ago
















4














I currently have 2 unitary matrices that I want to approximate to a good precision with the fewer quantum gates possible.



In my case the two matrices are:




  • $$G = frac{-1}{sqrt{2}}begin{pmatrix} i & 1 \ 1 & i end{pmatrix}$$

  • $$W =
    begin{pmatrix}
    1&0&0&0\
    0&frac{1}{sqrt{2}}&frac{1}{sqrt{2}}&0\
    0&frac{1}{sqrt{2}}&frac{-1}{sqrt{2}}&0\
    0&0&0&1 \
    end{pmatrix}$$


My question is the following:




How can I approximate these specific matrices with the fewer quantum gates possible and a good precision?




What I want to have an can afford to have it:




  1. I can afford to use several days/weeks of CPU time and a lot of RAM.

  2. I can afford to spend 1 or 2 human days searching for mathematical tricks (in last resort, that is why I ask here first). This time does not include the time I would need to implement the hypothetical algorithms used for the first point.

  3. I want the decomposition to be nearly exact. I don't have a target precision at the moment, but the 2 gates above are used extensively by my circuit and I don't want errors to accumulate too much.

  4. I want the decomposition to use the fewest quantum gates possible. This point is secondary for the moment.

  5. A good method would let me choose the trade-off I want between the number of quantum gates and the precision of the approximation. If this is not possible, an accuracy of at least $10^{-6}$ (in terms of trace norm) is probably (as said before, I do not have estimates so I am not sure of this threshold) required.

  6. The gate set is:
    $$
    left{ H, X, Y, Z, R_phi, S, T, R_x, R_y, R_z, text{CX}, text{SWAP}, text{iSWAP}, sqrt{text{SWAP}} right}
    $$

    with $R_phi, text{SWAP}, sqrt{text{SWAP}}$ as described in Wikipédia, $R_A$ the rotation with respect to the axe $A$ ($A$ is either $X$, $Y$ or $Z$) and
    $$text{iSWAP} = begin{pmatrix} 1 & 0 & 0 & 0 \
    0 & 0 & i & 0 \
    0 & i & 0 & 0 \
    0 & 0 & 0 & 1 \ end{pmatrix}$$
    .


The methods I know about:




  1. The Solovay-Kitaev algorithm. I have an implementation of this algorithm and already tested it on several unitary matrices. The algorithm generates sequences that are quite long and the trade-off [number of quantum gates] VS [precision of the approximation] is not enough parametrisable. Nevertheless, I will execute the algorithm on these gates and edit this question with the results I obtained.

  2. Two papers on 1-qubit gate approximation and n-qubit gate approximation. I also need to test these algorithms.










share|improve this question
























  • Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    – Mithrandir24601
    5 hours ago






  • 1




    Edited to precise the gate-set I had in mind :)
    – Nelimee
    5 hours ago










  • Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    – Norbert Schuch
    2 hours ago














4












4








4







I currently have 2 unitary matrices that I want to approximate to a good precision with the fewer quantum gates possible.



In my case the two matrices are:




  • $$G = frac{-1}{sqrt{2}}begin{pmatrix} i & 1 \ 1 & i end{pmatrix}$$

  • $$W =
    begin{pmatrix}
    1&0&0&0\
    0&frac{1}{sqrt{2}}&frac{1}{sqrt{2}}&0\
    0&frac{1}{sqrt{2}}&frac{-1}{sqrt{2}}&0\
    0&0&0&1 \
    end{pmatrix}$$


My question is the following:




How can I approximate these specific matrices with the fewer quantum gates possible and a good precision?




What I want to have an can afford to have it:




  1. I can afford to use several days/weeks of CPU time and a lot of RAM.

  2. I can afford to spend 1 or 2 human days searching for mathematical tricks (in last resort, that is why I ask here first). This time does not include the time I would need to implement the hypothetical algorithms used for the first point.

  3. I want the decomposition to be nearly exact. I don't have a target precision at the moment, but the 2 gates above are used extensively by my circuit and I don't want errors to accumulate too much.

  4. I want the decomposition to use the fewest quantum gates possible. This point is secondary for the moment.

  5. A good method would let me choose the trade-off I want between the number of quantum gates and the precision of the approximation. If this is not possible, an accuracy of at least $10^{-6}$ (in terms of trace norm) is probably (as said before, I do not have estimates so I am not sure of this threshold) required.

  6. The gate set is:
    $$
    left{ H, X, Y, Z, R_phi, S, T, R_x, R_y, R_z, text{CX}, text{SWAP}, text{iSWAP}, sqrt{text{SWAP}} right}
    $$

    with $R_phi, text{SWAP}, sqrt{text{SWAP}}$ as described in Wikipédia, $R_A$ the rotation with respect to the axe $A$ ($A$ is either $X$, $Y$ or $Z$) and
    $$text{iSWAP} = begin{pmatrix} 1 & 0 & 0 & 0 \
    0 & 0 & i & 0 \
    0 & i & 0 & 0 \
    0 & 0 & 0 & 1 \ end{pmatrix}$$
    .


The methods I know about:




  1. The Solovay-Kitaev algorithm. I have an implementation of this algorithm and already tested it on several unitary matrices. The algorithm generates sequences that are quite long and the trade-off [number of quantum gates] VS [precision of the approximation] is not enough parametrisable. Nevertheless, I will execute the algorithm on these gates and edit this question with the results I obtained.

  2. Two papers on 1-qubit gate approximation and n-qubit gate approximation. I also need to test these algorithms.










share|improve this question















I currently have 2 unitary matrices that I want to approximate to a good precision with the fewer quantum gates possible.



In my case the two matrices are:




  • $$G = frac{-1}{sqrt{2}}begin{pmatrix} i & 1 \ 1 & i end{pmatrix}$$

  • $$W =
    begin{pmatrix}
    1&0&0&0\
    0&frac{1}{sqrt{2}}&frac{1}{sqrt{2}}&0\
    0&frac{1}{sqrt{2}}&frac{-1}{sqrt{2}}&0\
    0&0&0&1 \
    end{pmatrix}$$


My question is the following:




How can I approximate these specific matrices with the fewer quantum gates possible and a good precision?




What I want to have an can afford to have it:




  1. I can afford to use several days/weeks of CPU time and a lot of RAM.

  2. I can afford to spend 1 or 2 human days searching for mathematical tricks (in last resort, that is why I ask here first). This time does not include the time I would need to implement the hypothetical algorithms used for the first point.

  3. I want the decomposition to be nearly exact. I don't have a target precision at the moment, but the 2 gates above are used extensively by my circuit and I don't want errors to accumulate too much.

  4. I want the decomposition to use the fewest quantum gates possible. This point is secondary for the moment.

  5. A good method would let me choose the trade-off I want between the number of quantum gates and the precision of the approximation. If this is not possible, an accuracy of at least $10^{-6}$ (in terms of trace norm) is probably (as said before, I do not have estimates so I am not sure of this threshold) required.

  6. The gate set is:
    $$
    left{ H, X, Y, Z, R_phi, S, T, R_x, R_y, R_z, text{CX}, text{SWAP}, text{iSWAP}, sqrt{text{SWAP}} right}
    $$

    with $R_phi, text{SWAP}, sqrt{text{SWAP}}$ as described in Wikipédia, $R_A$ the rotation with respect to the axe $A$ ($A$ is either $X$, $Y$ or $Z$) and
    $$text{iSWAP} = begin{pmatrix} 1 & 0 & 0 & 0 \
    0 & 0 & i & 0 \
    0 & i & 0 & 0 \
    0 & 0 & 0 & 1 \ end{pmatrix}$$
    .


The methods I know about:




  1. The Solovay-Kitaev algorithm. I have an implementation of this algorithm and already tested it on several unitary matrices. The algorithm generates sequences that are quite long and the trade-off [number of quantum gates] VS [precision of the approximation] is not enough parametrisable. Nevertheless, I will execute the algorithm on these gates and edit this question with the results I obtained.

  2. Two papers on 1-qubit gate approximation and n-qubit gate approximation. I also need to test these algorithms.







gate-synthesis






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 5 hours ago

























asked 6 hours ago









Nelimee

1,350225




1,350225












  • Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    – Mithrandir24601
    5 hours ago






  • 1




    Edited to precise the gate-set I had in mind :)
    – Nelimee
    5 hours ago










  • Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    – Norbert Schuch
    2 hours ago


















  • Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    – Mithrandir24601
    5 hours ago






  • 1




    Edited to precise the gate-set I had in mind :)
    – Nelimee
    5 hours ago










  • Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    – Norbert Schuch
    2 hours ago
















Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
– Mithrandir24601
5 hours ago




Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
– Mithrandir24601
5 hours ago




1




1




Edited to precise the gate-set I had in mind :)
– Nelimee
5 hours ago




Edited to precise the gate-set I had in mind :)
– Nelimee
5 hours ago












Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
– Norbert Schuch
2 hours ago




Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
– Norbert Schuch
2 hours ago










3 Answers
3






active

oldest

votes


















2














Neither of these gates require approximate sequences. You can implement them exactly with your specified gate sets with no great effort.



Up to a global phase (which should be irrelevant), G is simply $HSH$.



The second, $W$, is a little more complicated. The way that I constructed this was to think of it as a controlled-Hadamard where I then required a basis change which is created by a controlled-not. One therefore has the circuit



enter image description here



where $U=cosfrac{pi}{8}mathbb{I}-isinfrac{pi}{8}Y$. I always get factors of 2 wrong in these angles, but this is of the form $R_Y(theta)$. I've taken no particular effort to optimise this gate sequence, but this is probably fairly good.






share|improve this answer





























    0














    When a two qubit gate $W$ can be expressed (up to a global phase) in the computational basis by a matrix with entirely real entries, i.e., $W in O(4)$, then there is general construction of implementing the gate with $CNOTs$ and single qubit gates, please see Vatan and Williams.



    The construction is optimal in the sense that it requires two CNOT gates and at most 12 single qubit gates (for the most general case of a real two qubit gate).
    The construction is based on the homomorphism:



    $$SO(4) approx SU(2) times SU(2),$$
    which asserts that any two-qubit gate $W$ with real entries can be expressed as:
    $$W = M U M^{dagger}$$
    with $Uin SU(2) otimes SU(2)$ , i.e., can be implemented by two single qubit gates.



    A matrix $M$ inducing this homomorphism is named by Makhlin the magic matrix, one possible solution is given on the bottom of page 2 in Vatan and Williams work, another possibility is given in equation (10) by Fujii.
    Vatan and Williams gave a construction with one CNOT for $M$



    enter image description here



    Using this construction, the full gate implementation given by Vatan and Williams is:



    enter image description here



    with $S_1 = S_z(frac{pi}{2})$ and $R_1 = S_y(frac{pi}{2})$



    Using this construction, it should be a quite an easy exercise to compute the one-qubit gates $A$ and $B$, for your case.






    share|improve this answer





























      0














      You have picked two particularly simple matrices to implement.



      The first operation (G) is just the square root of X gate (up to global phase):



      G gate



      If you want to limit yourself to the CNOT+H+S+T gate set, this operation decomposes as $H cdot S cdot H$.



      G gate again



      The second operation (W) is a Hadamard matrix in the middle 2x2 block of an otherwise-identity matrix. Anytime you see this 2x2-in-the-middle pattern you should think "controlled operation conjugated by CNOTs". And that's exactly what works here (note: you may need to swap the lines; depends on your endianness convention):



      W operation



      So the only real trouble is how to implement a controlled Hadamard operation. A Hadamard is a 180 degree rotation around the X+Z axis. You can use a 45 degree rotation around the Y axis to move the X+Z axis to the Z axis, then do a Z, then move the axis back:



      W operation again



      If you are limiting yourself to CNOT+H+S+T you can use S+H gates to move the Y axis to the Z axis, then use T gates ($Z^{1/4}$). This will also happen to turn the CZ into a CNOT:



      W operation yet again





      share





















        Your Answer





        StackExchange.ifUsing("editor", function () {
        return StackExchange.using("mathjaxEditing", function () {
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
        });
        });
        }, "mathjax-editing");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "694"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        noCode: true, onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f5058%2fapproximating-unitary-matrices%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        Neither of these gates require approximate sequences. You can implement them exactly with your specified gate sets with no great effort.



        Up to a global phase (which should be irrelevant), G is simply $HSH$.



        The second, $W$, is a little more complicated. The way that I constructed this was to think of it as a controlled-Hadamard where I then required a basis change which is created by a controlled-not. One therefore has the circuit



        enter image description here



        where $U=cosfrac{pi}{8}mathbb{I}-isinfrac{pi}{8}Y$. I always get factors of 2 wrong in these angles, but this is of the form $R_Y(theta)$. I've taken no particular effort to optimise this gate sequence, but this is probably fairly good.






        share|improve this answer


























          2














          Neither of these gates require approximate sequences. You can implement them exactly with your specified gate sets with no great effort.



          Up to a global phase (which should be irrelevant), G is simply $HSH$.



          The second, $W$, is a little more complicated. The way that I constructed this was to think of it as a controlled-Hadamard where I then required a basis change which is created by a controlled-not. One therefore has the circuit



          enter image description here



          where $U=cosfrac{pi}{8}mathbb{I}-isinfrac{pi}{8}Y$. I always get factors of 2 wrong in these angles, but this is of the form $R_Y(theta)$. I've taken no particular effort to optimise this gate sequence, but this is probably fairly good.






          share|improve this answer
























            2












            2








            2






            Neither of these gates require approximate sequences. You can implement them exactly with your specified gate sets with no great effort.



            Up to a global phase (which should be irrelevant), G is simply $HSH$.



            The second, $W$, is a little more complicated. The way that I constructed this was to think of it as a controlled-Hadamard where I then required a basis change which is created by a controlled-not. One therefore has the circuit



            enter image description here



            where $U=cosfrac{pi}{8}mathbb{I}-isinfrac{pi}{8}Y$. I always get factors of 2 wrong in these angles, but this is of the form $R_Y(theta)$. I've taken no particular effort to optimise this gate sequence, but this is probably fairly good.






            share|improve this answer












            Neither of these gates require approximate sequences. You can implement them exactly with your specified gate sets with no great effort.



            Up to a global phase (which should be irrelevant), G is simply $HSH$.



            The second, $W$, is a little more complicated. The way that I constructed this was to think of it as a controlled-Hadamard where I then required a basis change which is created by a controlled-not. One therefore has the circuit



            enter image description here



            where $U=cosfrac{pi}{8}mathbb{I}-isinfrac{pi}{8}Y$. I always get factors of 2 wrong in these angles, but this is of the form $R_Y(theta)$. I've taken no particular effort to optimise this gate sequence, but this is probably fairly good.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 hours ago









            DaftWullie

            11.9k1536




            11.9k1536

























                0














                When a two qubit gate $W$ can be expressed (up to a global phase) in the computational basis by a matrix with entirely real entries, i.e., $W in O(4)$, then there is general construction of implementing the gate with $CNOTs$ and single qubit gates, please see Vatan and Williams.



                The construction is optimal in the sense that it requires two CNOT gates and at most 12 single qubit gates (for the most general case of a real two qubit gate).
                The construction is based on the homomorphism:



                $$SO(4) approx SU(2) times SU(2),$$
                which asserts that any two-qubit gate $W$ with real entries can be expressed as:
                $$W = M U M^{dagger}$$
                with $Uin SU(2) otimes SU(2)$ , i.e., can be implemented by two single qubit gates.



                A matrix $M$ inducing this homomorphism is named by Makhlin the magic matrix, one possible solution is given on the bottom of page 2 in Vatan and Williams work, another possibility is given in equation (10) by Fujii.
                Vatan and Williams gave a construction with one CNOT for $M$



                enter image description here



                Using this construction, the full gate implementation given by Vatan and Williams is:



                enter image description here



                with $S_1 = S_z(frac{pi}{2})$ and $R_1 = S_y(frac{pi}{2})$



                Using this construction, it should be a quite an easy exercise to compute the one-qubit gates $A$ and $B$, for your case.






                share|improve this answer


























                  0














                  When a two qubit gate $W$ can be expressed (up to a global phase) in the computational basis by a matrix with entirely real entries, i.e., $W in O(4)$, then there is general construction of implementing the gate with $CNOTs$ and single qubit gates, please see Vatan and Williams.



                  The construction is optimal in the sense that it requires two CNOT gates and at most 12 single qubit gates (for the most general case of a real two qubit gate).
                  The construction is based on the homomorphism:



                  $$SO(4) approx SU(2) times SU(2),$$
                  which asserts that any two-qubit gate $W$ with real entries can be expressed as:
                  $$W = M U M^{dagger}$$
                  with $Uin SU(2) otimes SU(2)$ , i.e., can be implemented by two single qubit gates.



                  A matrix $M$ inducing this homomorphism is named by Makhlin the magic matrix, one possible solution is given on the bottom of page 2 in Vatan and Williams work, another possibility is given in equation (10) by Fujii.
                  Vatan and Williams gave a construction with one CNOT for $M$



                  enter image description here



                  Using this construction, the full gate implementation given by Vatan and Williams is:



                  enter image description here



                  with $S_1 = S_z(frac{pi}{2})$ and $R_1 = S_y(frac{pi}{2})$



                  Using this construction, it should be a quite an easy exercise to compute the one-qubit gates $A$ and $B$, for your case.






                  share|improve this answer
























                    0












                    0








                    0






                    When a two qubit gate $W$ can be expressed (up to a global phase) in the computational basis by a matrix with entirely real entries, i.e., $W in O(4)$, then there is general construction of implementing the gate with $CNOTs$ and single qubit gates, please see Vatan and Williams.



                    The construction is optimal in the sense that it requires two CNOT gates and at most 12 single qubit gates (for the most general case of a real two qubit gate).
                    The construction is based on the homomorphism:



                    $$SO(4) approx SU(2) times SU(2),$$
                    which asserts that any two-qubit gate $W$ with real entries can be expressed as:
                    $$W = M U M^{dagger}$$
                    with $Uin SU(2) otimes SU(2)$ , i.e., can be implemented by two single qubit gates.



                    A matrix $M$ inducing this homomorphism is named by Makhlin the magic matrix, one possible solution is given on the bottom of page 2 in Vatan and Williams work, another possibility is given in equation (10) by Fujii.
                    Vatan and Williams gave a construction with one CNOT for $M$



                    enter image description here



                    Using this construction, the full gate implementation given by Vatan and Williams is:



                    enter image description here



                    with $S_1 = S_z(frac{pi}{2})$ and $R_1 = S_y(frac{pi}{2})$



                    Using this construction, it should be a quite an easy exercise to compute the one-qubit gates $A$ and $B$, for your case.






                    share|improve this answer












                    When a two qubit gate $W$ can be expressed (up to a global phase) in the computational basis by a matrix with entirely real entries, i.e., $W in O(4)$, then there is general construction of implementing the gate with $CNOTs$ and single qubit gates, please see Vatan and Williams.



                    The construction is optimal in the sense that it requires two CNOT gates and at most 12 single qubit gates (for the most general case of a real two qubit gate).
                    The construction is based on the homomorphism:



                    $$SO(4) approx SU(2) times SU(2),$$
                    which asserts that any two-qubit gate $W$ with real entries can be expressed as:
                    $$W = M U M^{dagger}$$
                    with $Uin SU(2) otimes SU(2)$ , i.e., can be implemented by two single qubit gates.



                    A matrix $M$ inducing this homomorphism is named by Makhlin the magic matrix, one possible solution is given on the bottom of page 2 in Vatan and Williams work, another possibility is given in equation (10) by Fujii.
                    Vatan and Williams gave a construction with one CNOT for $M$



                    enter image description here



                    Using this construction, the full gate implementation given by Vatan and Williams is:



                    enter image description here



                    with $S_1 = S_z(frac{pi}{2})$ and $R_1 = S_y(frac{pi}{2})$



                    Using this construction, it should be a quite an easy exercise to compute the one-qubit gates $A$ and $B$, for your case.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 52 mins ago









                    David Bar Moshe

                    1,0347




                    1,0347























                        0














                        You have picked two particularly simple matrices to implement.



                        The first operation (G) is just the square root of X gate (up to global phase):



                        G gate



                        If you want to limit yourself to the CNOT+H+S+T gate set, this operation decomposes as $H cdot S cdot H$.



                        G gate again



                        The second operation (W) is a Hadamard matrix in the middle 2x2 block of an otherwise-identity matrix. Anytime you see this 2x2-in-the-middle pattern you should think "controlled operation conjugated by CNOTs". And that's exactly what works here (note: you may need to swap the lines; depends on your endianness convention):



                        W operation



                        So the only real trouble is how to implement a controlled Hadamard operation. A Hadamard is a 180 degree rotation around the X+Z axis. You can use a 45 degree rotation around the Y axis to move the X+Z axis to the Z axis, then do a Z, then move the axis back:



                        W operation again



                        If you are limiting yourself to CNOT+H+S+T you can use S+H gates to move the Y axis to the Z axis, then use T gates ($Z^{1/4}$). This will also happen to turn the CZ into a CNOT:



                        W operation yet again





                        share


























                          0














                          You have picked two particularly simple matrices to implement.



                          The first operation (G) is just the square root of X gate (up to global phase):



                          G gate



                          If you want to limit yourself to the CNOT+H+S+T gate set, this operation decomposes as $H cdot S cdot H$.



                          G gate again



                          The second operation (W) is a Hadamard matrix in the middle 2x2 block of an otherwise-identity matrix. Anytime you see this 2x2-in-the-middle pattern you should think "controlled operation conjugated by CNOTs". And that's exactly what works here (note: you may need to swap the lines; depends on your endianness convention):



                          W operation



                          So the only real trouble is how to implement a controlled Hadamard operation. A Hadamard is a 180 degree rotation around the X+Z axis. You can use a 45 degree rotation around the Y axis to move the X+Z axis to the Z axis, then do a Z, then move the axis back:



                          W operation again



                          If you are limiting yourself to CNOT+H+S+T you can use S+H gates to move the Y axis to the Z axis, then use T gates ($Z^{1/4}$). This will also happen to turn the CZ into a CNOT:



                          W operation yet again





                          share
























                            0












                            0








                            0






                            You have picked two particularly simple matrices to implement.



                            The first operation (G) is just the square root of X gate (up to global phase):



                            G gate



                            If you want to limit yourself to the CNOT+H+S+T gate set, this operation decomposes as $H cdot S cdot H$.



                            G gate again



                            The second operation (W) is a Hadamard matrix in the middle 2x2 block of an otherwise-identity matrix. Anytime you see this 2x2-in-the-middle pattern you should think "controlled operation conjugated by CNOTs". And that's exactly what works here (note: you may need to swap the lines; depends on your endianness convention):



                            W operation



                            So the only real trouble is how to implement a controlled Hadamard operation. A Hadamard is a 180 degree rotation around the X+Z axis. You can use a 45 degree rotation around the Y axis to move the X+Z axis to the Z axis, then do a Z, then move the axis back:



                            W operation again



                            If you are limiting yourself to CNOT+H+S+T you can use S+H gates to move the Y axis to the Z axis, then use T gates ($Z^{1/4}$). This will also happen to turn the CZ into a CNOT:



                            W operation yet again





                            share












                            You have picked two particularly simple matrices to implement.



                            The first operation (G) is just the square root of X gate (up to global phase):



                            G gate



                            If you want to limit yourself to the CNOT+H+S+T gate set, this operation decomposes as $H cdot S cdot H$.



                            G gate again



                            The second operation (W) is a Hadamard matrix in the middle 2x2 block of an otherwise-identity matrix. Anytime you see this 2x2-in-the-middle pattern you should think "controlled operation conjugated by CNOTs". And that's exactly what works here (note: you may need to swap the lines; depends on your endianness convention):



                            W operation



                            So the only real trouble is how to implement a controlled Hadamard operation. A Hadamard is a 180 degree rotation around the X+Z axis. You can use a 45 degree rotation around the Y axis to move the X+Z axis to the Z axis, then do a Z, then move the axis back:



                            W operation again



                            If you are limiting yourself to CNOT+H+S+T you can use S+H gates to move the Y axis to the Z axis, then use T gates ($Z^{1/4}$). This will also happen to turn the CZ into a CNOT:



                            W operation yet again






                            share











                            share


                            share










                            answered 1 min ago









                            Craig Gidney

                            3,392220




                            3,392220






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Quantum Computing Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                Use MathJax to format equations. MathJax reference.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f5058%2fapproximating-unitary-matrices%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Lallio

                                Futebolista

                                Jornalista