How is the Deutsch algorithm faster than classical for practical implementation?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












There is something I really misunderstand about the Deutch-Algorithm.



To check if $f$ is balanced or constant, we use the following algorithm :



enter image description here



Where $U_f$ gives $(x,y) rightarrow (x, y oplus f(x))$.



Let's take $n=1$ for simplicity (thus the function $f$ is defined on $(0,1)$).



We have $4$ possible $U_f$ associated to $2$ constants possibility ($f$ equal to $0$ or $1$), and two balanced possibilities.



So, in practice, if I want to implement this in a circuit, I have to know exactly the "matrix" of $U_f$. And to do it I have to compute $f$ $2$ times. Thus, I know if $f$ is balanced or constant even before having applied the quantum algorithm. So for a practical aspect, I don't understand what is the point of this.



Said differently, if I am given $U_f$ I agree that in $1$ step I will know if $f$ is balanced or constant. But if I know $U_f$ I already know the answer to this question.



I am a little confused...










share|improve this question









New contributor




StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    2
    down vote

    favorite












    There is something I really misunderstand about the Deutch-Algorithm.



    To check if $f$ is balanced or constant, we use the following algorithm :



    enter image description here



    Where $U_f$ gives $(x,y) rightarrow (x, y oplus f(x))$.



    Let's take $n=1$ for simplicity (thus the function $f$ is defined on $(0,1)$).



    We have $4$ possible $U_f$ associated to $2$ constants possibility ($f$ equal to $0$ or $1$), and two balanced possibilities.



    So, in practice, if I want to implement this in a circuit, I have to know exactly the "matrix" of $U_f$. And to do it I have to compute $f$ $2$ times. Thus, I know if $f$ is balanced or constant even before having applied the quantum algorithm. So for a practical aspect, I don't understand what is the point of this.



    Said differently, if I am given $U_f$ I agree that in $1$ step I will know if $f$ is balanced or constant. But if I know $U_f$ I already know the answer to this question.



    I am a little confused...










    share|improve this question









    New contributor




    StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      There is something I really misunderstand about the Deutch-Algorithm.



      To check if $f$ is balanced or constant, we use the following algorithm :



      enter image description here



      Where $U_f$ gives $(x,y) rightarrow (x, y oplus f(x))$.



      Let's take $n=1$ for simplicity (thus the function $f$ is defined on $(0,1)$).



      We have $4$ possible $U_f$ associated to $2$ constants possibility ($f$ equal to $0$ or $1$), and two balanced possibilities.



      So, in practice, if I want to implement this in a circuit, I have to know exactly the "matrix" of $U_f$. And to do it I have to compute $f$ $2$ times. Thus, I know if $f$ is balanced or constant even before having applied the quantum algorithm. So for a practical aspect, I don't understand what is the point of this.



      Said differently, if I am given $U_f$ I agree that in $1$ step I will know if $f$ is balanced or constant. But if I know $U_f$ I already know the answer to this question.



      I am a little confused...










      share|improve this question









      New contributor




      StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      There is something I really misunderstand about the Deutch-Algorithm.



      To check if $f$ is balanced or constant, we use the following algorithm :



      enter image description here



      Where $U_f$ gives $(x,y) rightarrow (x, y oplus f(x))$.



      Let's take $n=1$ for simplicity (thus the function $f$ is defined on $(0,1)$).



      We have $4$ possible $U_f$ associated to $2$ constants possibility ($f$ equal to $0$ or $1$), and two balanced possibilities.



      So, in practice, if I want to implement this in a circuit, I have to know exactly the "matrix" of $U_f$. And to do it I have to compute $f$ $2$ times. Thus, I know if $f$ is balanced or constant even before having applied the quantum algorithm. So for a practical aspect, I don't understand what is the point of this.



      Said differently, if I am given $U_f$ I agree that in $1$ step I will know if $f$ is balanced or constant. But if I know $U_f$ I already know the answer to this question.



      I am a little confused...







      quantum-algorithms deutsch-algorithm






      share|improve this question









      New contributor




      StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 hour ago









      Blue

      5,49511148




      5,49511148






      New contributor




      StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 hours ago









      StarBucK

      1283




      1283




      New contributor




      StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      StarBucK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          If you see the operator only from the unitary matrix point of view and you enumerate all inputs/outputs, which makes you visualize the matrix, indeed you somehow already know the answer.



          However, imagine now $n$ is very large, say just $n>50$ or $n>60$, it becomes a bit difficult to store a $2^n * 2^n$ unitary matrix. But if you can compute the function, that is having a sequence of gates representing the operation, you can just apply it without having a knowledge of the unitary.



          Let us give you an example just on n=3:
          $$ f(x) = x_0 oplus x_1 x_2 $$



          To apply $ U_f $, we just need a $CNOT$ and a Toffoli gate representing the different operations of $f$, and apply directly, without necessarily having a knowledge of the unitary to build it (just decomposing into "simple" operations). You can extend to examples where $n$ is very large.






          share|improve this answer



























            up vote
            1
            down vote













            I think there are probably two points to make here:



            1. The way that one implements quantum computation is not by simply looking at the unitary matrix and building something out of that, in just the same way that classical computation is not performed simply by first building the truth table and working off that (otherwise all classical computations would be exponential). Instead, as cnada says, the computation is itself built out of simple gates. The simplest is "do nothing" which is a perfectly good example of a constant algorithm. I don't need to see the unitary to build that!


            2. The context of an oracle is that you don't build it yourself, so you don't know the unitary. Somebody else gives it to you (or perhaps you'll have built it as the result of another computation), with certain promised properties, and it is your job to determine the relevant parameters. Of course, if you want to practically test whether that works, you'll build it all yourself. But then, you don't care about the efficiency saving during the test, because of course you know what you've built. Indeed, you need to know what you've built because otherwise your test cannot work; you don't know what to check the outcome against.


            Incidentally, I think this question is closely related.






            share|improve this answer




















              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',
              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
              );



              );






              StarBucK is a new contributor. Be nice, and check out our Code of Conduct.









               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f4628%2fhow-is-the-deutsch-algorithm-faster-than-classical-for-practical-implementation%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote













              If you see the operator only from the unitary matrix point of view and you enumerate all inputs/outputs, which makes you visualize the matrix, indeed you somehow already know the answer.



              However, imagine now $n$ is very large, say just $n>50$ or $n>60$, it becomes a bit difficult to store a $2^n * 2^n$ unitary matrix. But if you can compute the function, that is having a sequence of gates representing the operation, you can just apply it without having a knowledge of the unitary.



              Let us give you an example just on n=3:
              $$ f(x) = x_0 oplus x_1 x_2 $$



              To apply $ U_f $, we just need a $CNOT$ and a Toffoli gate representing the different operations of $f$, and apply directly, without necessarily having a knowledge of the unitary to build it (just decomposing into "simple" operations). You can extend to examples where $n$ is very large.






              share|improve this answer
























                up vote
                2
                down vote













                If you see the operator only from the unitary matrix point of view and you enumerate all inputs/outputs, which makes you visualize the matrix, indeed you somehow already know the answer.



                However, imagine now $n$ is very large, say just $n>50$ or $n>60$, it becomes a bit difficult to store a $2^n * 2^n$ unitary matrix. But if you can compute the function, that is having a sequence of gates representing the operation, you can just apply it without having a knowledge of the unitary.



                Let us give you an example just on n=3:
                $$ f(x) = x_0 oplus x_1 x_2 $$



                To apply $ U_f $, we just need a $CNOT$ and a Toffoli gate representing the different operations of $f$, and apply directly, without necessarily having a knowledge of the unitary to build it (just decomposing into "simple" operations). You can extend to examples where $n$ is very large.






                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  If you see the operator only from the unitary matrix point of view and you enumerate all inputs/outputs, which makes you visualize the matrix, indeed you somehow already know the answer.



                  However, imagine now $n$ is very large, say just $n>50$ or $n>60$, it becomes a bit difficult to store a $2^n * 2^n$ unitary matrix. But if you can compute the function, that is having a sequence of gates representing the operation, you can just apply it without having a knowledge of the unitary.



                  Let us give you an example just on n=3:
                  $$ f(x) = x_0 oplus x_1 x_2 $$



                  To apply $ U_f $, we just need a $CNOT$ and a Toffoli gate representing the different operations of $f$, and apply directly, without necessarily having a knowledge of the unitary to build it (just decomposing into "simple" operations). You can extend to examples where $n$ is very large.






                  share|improve this answer












                  If you see the operator only from the unitary matrix point of view and you enumerate all inputs/outputs, which makes you visualize the matrix, indeed you somehow already know the answer.



                  However, imagine now $n$ is very large, say just $n>50$ or $n>60$, it becomes a bit difficult to store a $2^n * 2^n$ unitary matrix. But if you can compute the function, that is having a sequence of gates representing the operation, you can just apply it without having a knowledge of the unitary.



                  Let us give you an example just on n=3:
                  $$ f(x) = x_0 oplus x_1 x_2 $$



                  To apply $ U_f $, we just need a $CNOT$ and a Toffoli gate representing the different operations of $f$, and apply directly, without necessarily having a knowledge of the unitary to build it (just decomposing into "simple" operations). You can extend to examples where $n$ is very large.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  cnada

                  1,29619




                  1,29619






















                      up vote
                      1
                      down vote













                      I think there are probably two points to make here:



                      1. The way that one implements quantum computation is not by simply looking at the unitary matrix and building something out of that, in just the same way that classical computation is not performed simply by first building the truth table and working off that (otherwise all classical computations would be exponential). Instead, as cnada says, the computation is itself built out of simple gates. The simplest is "do nothing" which is a perfectly good example of a constant algorithm. I don't need to see the unitary to build that!


                      2. The context of an oracle is that you don't build it yourself, so you don't know the unitary. Somebody else gives it to you (or perhaps you'll have built it as the result of another computation), with certain promised properties, and it is your job to determine the relevant parameters. Of course, if you want to practically test whether that works, you'll build it all yourself. But then, you don't care about the efficiency saving during the test, because of course you know what you've built. Indeed, you need to know what you've built because otherwise your test cannot work; you don't know what to check the outcome against.


                      Incidentally, I think this question is closely related.






                      share|improve this answer
























                        up vote
                        1
                        down vote













                        I think there are probably two points to make here:



                        1. The way that one implements quantum computation is not by simply looking at the unitary matrix and building something out of that, in just the same way that classical computation is not performed simply by first building the truth table and working off that (otherwise all classical computations would be exponential). Instead, as cnada says, the computation is itself built out of simple gates. The simplest is "do nothing" which is a perfectly good example of a constant algorithm. I don't need to see the unitary to build that!


                        2. The context of an oracle is that you don't build it yourself, so you don't know the unitary. Somebody else gives it to you (or perhaps you'll have built it as the result of another computation), with certain promised properties, and it is your job to determine the relevant parameters. Of course, if you want to practically test whether that works, you'll build it all yourself. But then, you don't care about the efficiency saving during the test, because of course you know what you've built. Indeed, you need to know what you've built because otherwise your test cannot work; you don't know what to check the outcome against.


                        Incidentally, I think this question is closely related.






                        share|improve this answer






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          I think there are probably two points to make here:



                          1. The way that one implements quantum computation is not by simply looking at the unitary matrix and building something out of that, in just the same way that classical computation is not performed simply by first building the truth table and working off that (otherwise all classical computations would be exponential). Instead, as cnada says, the computation is itself built out of simple gates. The simplest is "do nothing" which is a perfectly good example of a constant algorithm. I don't need to see the unitary to build that!


                          2. The context of an oracle is that you don't build it yourself, so you don't know the unitary. Somebody else gives it to you (or perhaps you'll have built it as the result of another computation), with certain promised properties, and it is your job to determine the relevant parameters. Of course, if you want to practically test whether that works, you'll build it all yourself. But then, you don't care about the efficiency saving during the test, because of course you know what you've built. Indeed, you need to know what you've built because otherwise your test cannot work; you don't know what to check the outcome against.


                          Incidentally, I think this question is closely related.






                          share|improve this answer












                          I think there are probably two points to make here:



                          1. The way that one implements quantum computation is not by simply looking at the unitary matrix and building something out of that, in just the same way that classical computation is not performed simply by first building the truth table and working off that (otherwise all classical computations would be exponential). Instead, as cnada says, the computation is itself built out of simple gates. The simplest is "do nothing" which is a perfectly good example of a constant algorithm. I don't need to see the unitary to build that!


                          2. The context of an oracle is that you don't build it yourself, so you don't know the unitary. Somebody else gives it to you (or perhaps you'll have built it as the result of another computation), with certain promised properties, and it is your job to determine the relevant parameters. Of course, if you want to practically test whether that works, you'll build it all yourself. But then, you don't care about the efficiency saving during the test, because of course you know what you've built. Indeed, you need to know what you've built because otherwise your test cannot work; you don't know what to check the outcome against.


                          Incidentally, I think this question is closely related.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 1 hour ago









                          DaftWullie

                          9,8271332




                          9,8271332




















                              StarBucK is a new contributor. Be nice, and check out our Code of Conduct.









                               

                              draft saved


                              draft discarded


















                              StarBucK is a new contributor. Be nice, and check out our Code of Conduct.












                              StarBucK is a new contributor. Be nice, and check out our Code of Conduct.











                              StarBucK is a new contributor. Be nice, and check out our Code of Conduct.













                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f4628%2fhow-is-the-deutsch-algorithm-faster-than-classical-for-practical-implementation%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              List of Gilmore Girls characters

                              Confectionery