Approximating unitary matrices












10












$begingroup$


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











$endgroup$












  • $begingroup$
    Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    $endgroup$
    – Mithrandir24601
    Dec 27 '18 at 10:05






  • 1




    $begingroup$
    Edited to precise the gate-set I had in mind :)
    $endgroup$
    – Nelimee
    Dec 27 '18 at 10:22










  • $begingroup$
    Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    $endgroup$
    – Norbert Schuch
    Dec 27 '18 at 13:55










  • $begingroup$
    I'm curious about what you're trying to do with this, if you wouldn't mind elaborating.
    $endgroup$
    – psitae
    Dec 31 '18 at 9:01










  • $begingroup$
    These two gates are appearing in quantum circuits to simulate very simple Hamiltonians (1-sparse hamiltonians with only real entries or only imaginary entries). The thesis that elaborate on this is quite hard to obtain. The only way I found is to ask for a copy here and wait for an answer on your mailbox :)
    $endgroup$
    – Nelimee
    Dec 31 '18 at 10:41
















10












$begingroup$


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











$endgroup$












  • $begingroup$
    Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    $endgroup$
    – Mithrandir24601
    Dec 27 '18 at 10:05






  • 1




    $begingroup$
    Edited to precise the gate-set I had in mind :)
    $endgroup$
    – Nelimee
    Dec 27 '18 at 10:22










  • $begingroup$
    Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    $endgroup$
    – Norbert Schuch
    Dec 27 '18 at 13:55










  • $begingroup$
    I'm curious about what you're trying to do with this, if you wouldn't mind elaborating.
    $endgroup$
    – psitae
    Dec 31 '18 at 9:01










  • $begingroup$
    These two gates are appearing in quantum circuits to simulate very simple Hamiltonians (1-sparse hamiltonians with only real entries or only imaginary entries). The thesis that elaborate on this is quite hard to obtain. The only way I found is to ask for a copy here and wait for an answer on your mailbox :)
    $endgroup$
    – Nelimee
    Dec 31 '18 at 10:41














10












10








10


1



$begingroup$


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











$endgroup$




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.







quantum-gate gate-synthesis solovay-kitaev-algorithm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 8:39









Blue

6,16831354




6,16831354










asked Dec 27 '18 at 9:30









NelimeeNelimee

1,570326




1,570326












  • $begingroup$
    Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    $endgroup$
    – Mithrandir24601
    Dec 27 '18 at 10:05






  • 1




    $begingroup$
    Edited to precise the gate-set I had in mind :)
    $endgroup$
    – Nelimee
    Dec 27 '18 at 10:22










  • $begingroup$
    Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    $endgroup$
    – Norbert Schuch
    Dec 27 '18 at 13:55










  • $begingroup$
    I'm curious about what you're trying to do with this, if you wouldn't mind elaborating.
    $endgroup$
    – psitae
    Dec 31 '18 at 9:01










  • $begingroup$
    These two gates are appearing in quantum circuits to simulate very simple Hamiltonians (1-sparse hamiltonians with only real entries or only imaginary entries). The thesis that elaborate on this is quite hard to obtain. The only way I found is to ask for a copy here and wait for an answer on your mailbox :)
    $endgroup$
    – Nelimee
    Dec 31 '18 at 10:41


















  • $begingroup$
    Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
    $endgroup$
    – Mithrandir24601
    Dec 27 '18 at 10:05






  • 1




    $begingroup$
    Edited to precise the gate-set I had in mind :)
    $endgroup$
    – Nelimee
    Dec 27 '18 at 10:22










  • $begingroup$
    Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
    $endgroup$
    – Norbert Schuch
    Dec 27 '18 at 13:55










  • $begingroup$
    I'm curious about what you're trying to do with this, if you wouldn't mind elaborating.
    $endgroup$
    – psitae
    Dec 31 '18 at 9:01










  • $begingroup$
    These two gates are appearing in quantum circuits to simulate very simple Hamiltonians (1-sparse hamiltonians with only real entries or only imaginary entries). The thesis that elaborate on this is quite hard to obtain. The only way I found is to ask for a copy here and wait for an answer on your mailbox :)
    $endgroup$
    – Nelimee
    Dec 31 '18 at 10:41
















$begingroup$
Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
$endgroup$
– Mithrandir24601
Dec 27 '18 at 10:05




$begingroup$
Do you have any specific gate-set in mind and is there a reason you can't implement $G$ natively/directly on the qubit?
$endgroup$
– Mithrandir24601
Dec 27 '18 at 10:05




1




1




$begingroup$
Edited to precise the gate-set I had in mind :)
$endgroup$
– Nelimee
Dec 27 '18 at 10:22




$begingroup$
Edited to precise the gate-set I had in mind :)
$endgroup$
– Nelimee
Dec 27 '18 at 10:22












$begingroup$
Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
$endgroup$
– Norbert Schuch
Dec 27 '18 at 13:55




$begingroup$
Looks like W can be done with the right sqrt(SWAP) + one CNOT + single-qubit gates.
$endgroup$
– Norbert Schuch
Dec 27 '18 at 13:55












$begingroup$
I'm curious about what you're trying to do with this, if you wouldn't mind elaborating.
$endgroup$
– psitae
Dec 31 '18 at 9:01




$begingroup$
I'm curious about what you're trying to do with this, if you wouldn't mind elaborating.
$endgroup$
– psitae
Dec 31 '18 at 9:01












$begingroup$
These two gates are appearing in quantum circuits to simulate very simple Hamiltonians (1-sparse hamiltonians with only real entries or only imaginary entries). The thesis that elaborate on this is quite hard to obtain. The only way I found is to ask for a copy here and wait for an answer on your mailbox :)
$endgroup$
– Nelimee
Dec 31 '18 at 10:41




$begingroup$
These two gates are appearing in quantum circuits to simulate very simple Hamiltonians (1-sparse hamiltonians with only real entries or only imaginary entries). The thesis that elaborate on this is quite hard to obtain. The only way I found is to ask for a copy here and wait for an answer on your mailbox :)
$endgroup$
– Nelimee
Dec 31 '18 at 10:41










3 Answers
3






active

oldest

votes


















6












$begingroup$

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



In your gate set, this is $R_X(pi/2)$.



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 X axis, then do a CNOT in place the CH, then move the axis back:



W operation again



Where $Y^{1/4} equiv R_Y(pi/4)$.






share|improve this answer









$endgroup$





















    3












    $begingroup$

    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









    $endgroup$





















      3












      $begingroup$

      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









      $endgroup$













        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









        6












        $begingroup$

        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



        In your gate set, this is $R_X(pi/2)$.



        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 X axis, then do a CNOT in place the CH, then move the axis back:



        W operation again



        Where $Y^{1/4} equiv R_Y(pi/4)$.






        share|improve this answer









        $endgroup$


















          6












          $begingroup$

          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



          In your gate set, this is $R_X(pi/2)$.



          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 X axis, then do a CNOT in place the CH, then move the axis back:



          W operation again



          Where $Y^{1/4} equiv R_Y(pi/4)$.






          share|improve this answer









          $endgroup$
















            6












            6








            6





            $begingroup$

            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



            In your gate set, this is $R_X(pi/2)$.



            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 X axis, then do a CNOT in place the CH, then move the axis back:



            W operation again



            Where $Y^{1/4} equiv R_Y(pi/4)$.






            share|improve this answer









            $endgroup$



            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



            In your gate set, this is $R_X(pi/2)$.



            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 X axis, then do a CNOT in place the CH, then move the axis back:



            W operation again



            Where $Y^{1/4} equiv R_Y(pi/4)$.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 27 '18 at 15:58









            Craig GidneyCraig Gidney

            4,196220




            4,196220

























                3












                $begingroup$

                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









                $endgroup$


















                  3












                  $begingroup$

                  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









                  $endgroup$
















                    3












                    3








                    3





                    $begingroup$

                    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









                    $endgroup$



                    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 Dec 27 '18 at 13:50









                    DaftWullieDaftWullie

                    13.8k1540




                    13.8k1540























                        3












                        $begingroup$

                        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









                        $endgroup$


















                          3












                          $begingroup$

                          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









                          $endgroup$
















                            3












                            3








                            3





                            $begingroup$

                            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









                            $endgroup$



                            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 Dec 27 '18 at 15:07









                            David Bar MosheDavid Bar Moshe

                            1,1647




                            1,1647






























                                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.




                                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

                                Bressuire

                                Cabo Verde

                                Gyllenstierna