# Patent

## Title
Method and relative quantum gate for running a Grover's or a Deutsch-Jozsa's quantum algorithm

## Abstract

A method of performing a Grover's or a Deutsch-Jozsa's quantum algorithm being input with a binary function defined on a space having a basis of vectors of n of qubits includes carrying out a superposition operation over input vectors for generating components of linear superposition vectors referred to a second basis of vectors of n+1 qubits. An entanglement operation is performed over components of the linear superposition vectors for generating components of numeric entanglement vectors. The method allows a non-negligible time savings because the entanglement operation does not multiply a superposition vector for an entanglement matrix, but generates components of an entanglement vector simply by copying or inverting respective components of the superposition vector depending on values of the binary function. An interference operation is performed over components of the numeric entanglement vectors for generating components of output vectors.

## Background
FIELD OF THE INVENTION
The present invention relates to quantum algorithms, and more precisely, to a method for performing a Grover's or a Deutsch-Jozsa's quantum algorithm and a corresponding quantum gate.
BACKGROUND OF THE INVENTION
Quantum search algorithms are global random searching algorithms based on the principles, laws and effects of quantum mechanics. They are used for controlling a process or for processing data in a database, and more specifically, for controlling a process that may include search-of-minima intelligent operations.
In a quantum search, each design variable is represented by a finite linear superposition of initial states, with a sequence of elementary unitary steps manipulating the initial quantum state (for the input) such that a measurement of the final state of the system yields the correct output. Usually, three principle operators, i.e., linear superposition (coherent states), entanglement and interference are used in the quantum search algorithm.
For a better understanding, a brief description of quantum search algorithms is provided. The problems solved by quantum algorithms may be stated as follows:
















Input
A function f: {0, 1}n → {0, 1}m



Problem
Find a certain property of f










The structure of a quantum algorithm is outlined by a high level representation in the schematic diagram of FIG. 1.

The input of a quantum algorithm is a function f from binary strings into binary strings. This function is represented as a map table, which defines for every string its image. Function f is first encoded into a unitary matrix operator UF depending on f properties. This operator calculates f when its input and output strings are encoded into canonical basis vectors of a Complex Hilbert Space: UF maps the vector code of every string into the vector code of its image by f.
















  
    
      
        
          
            
          
          ⁢
          
            BOX
            ⁢
            
              
            
            ⁢
            1
            ⁢
            
              :
            
            ⁢
            
              
            
            ⁢
            UNITARY
            ⁢
            
              
            
            ⁢
            MATRIX
            ⁢
            
              
            
            ⁢
            
              U
              F
            
          
        
      
    
    
      
        
          A
          ⁢
          
            
          
          ⁢
          squared
          ⁢
          
            
          
          ⁢
          matrix
          ⁢
          
            
          
          ⁢
          
            U
            F
          
          ⁢
          
            
          
          ⁢
          on
          ⁢
          
            
          
          ⁢
          the
          ⁢
          
            
          
          ⁢
          complex
          ⁢
          
            
          
          ⁢
          field
          ⁢
          
            
          
          ⁢
          is
          ⁢
          
            
          
          ⁢
          unitary
        
      
    
    
      
        
          if
          ⁢
          
            
          
          ⁢
          its
          ⁢
          
            
          
          ⁢
          inverse
          ⁢
          
            
          
          ⁢
          matrix
          ⁢
          
            
          
          ⁢
          coincides
          ⁢
          
            
          
          ⁢
          with
          ⁢
          
            
          
          ⁢
          its
          ⁢
          
            
          
          ⁢
          conjugate
        
      
    
    
      
        
          transposition
          ⁢
          
            :
          
        
      
    
    
      
        
          
            
          
          ⁢
          
            
              U
              F
              
                -
                1
              
            
            =
            
              U
              F
            
          
        
      
    
    
      
        
          A
          ⁢
          
            
          
          ⁢
          unitary
          ⁢
          
            
          
          ⁢
          matrix
          ⁢
          
            
          
          ⁢
          is
          ⁢
          
            
          
          ⁢
          always
          ⁢
          
            
          
          ⁢
          reversible
          ⁢
          
            
          
          ⁢
          and
          ⁢
          
            
          
          ⁢
          preserves
        
      
    
    
      
        
          the
          ⁢
          
            
          
          ⁢
          norm
          ⁢
          
            
          
          ⁢
          of
          ⁢
          
            
          
          ⁢
          
            vectors
            .
          
        
      
    
  
   













When the matrix operator UF has been generated, it is embedded into a quantum gate G, a unitary matrix whose structure depends on the form of matrix UF and on the problem to be solved. The quantum gate is the core of a quantum algorithm. In every quantum algorithm, the quantum gate acts on an initial canonical basis vector (the same vector may always be chosen) to generate a complex linear combination (called a superposition) of basis vectors as the output. This superposition contains all the information to answer the initial problem.
After this superposition has been created, a measurement takes place to extract this information. In quantum mechanics, measurement is a non-deterministic operation that produces as output only one of the basis vectors. The probability of every basis vector being the output of a measurement depends on its complex coefficient (probability amplitude) in entering a complex linear combination.
The segmental action of the quantum gate and of the measurement forms the quantum block. The quantum block is repeated k times to produce a collection of k basis vectors. In measuring a non-deterministic operation, these basis vectors would not be necessarily identical and each one of them will encode a piece of the information needed to solve the problem.
The last part of the algorithm includes interpretation of the collected basis vectors to get the right answer for the initial problem with a certain probability.
The behavior of the encoder block is described in the detailed schematic diagram of FIG. 2. Function f is encoded into matrix UF in three steps.
Step 1: The map table of function f: {0,1}n→{0,1}m is transformed into the map table of the infective function F: {0,1}n+m→{0,1}n+m such that:

F(x0, . . . , xn−1, y0, . . . , ym−1)=(x0, . . . , xn−1, f(x0, . . . , xn−1)⊕(y0, . . . , ym−1))  (1)

















  
    
      
        
          BOX
          ⁢
          
            
          
          ⁢
          2
          ⁢
          
            :
          
          ⁢
          
            
          
          ⁢
          XOR
          ⁢
          
            
          
          ⁢
          OPERATOR
        
        ⁢
        
          
        
        ⊕
      
    
  
  
    
      
        The
        ⁢
        
          
        
        ⁢
        XOR
        ⁢
        
          
        
        ⁢
        operator
        ⁢
        
          
        
        ⁢
        between
        ⁢
        
          
        
        ⁢
        two
        ⁢
        
          
        
        ⁢
        binary
        ⁢
        
          
        
        ⁢
        strings
        ⁢
        
          
        
        ⁢
        p
        ⁢
        
          
        
        ⁢
        and
        ⁢
        
          
        
        ⁢
        q
      
    
  
  
    
      
        
          of
          ⁢
          
            
          
          ⁢
          length
          ⁢
          
            
          
          ⁢
          m
          ⁢
          
            
          
          ⁢
          is
          ⁢
          
            
          
          ⁢
          a
          ⁢
          
            
          
          ⁢
          string
          ⁢
          
            
          
          ⁢
          s
          ⁢
          
            
          
          ⁢
          of
          ⁢
          
            
          
          ⁢
          length
          ⁢
          
            
          
          ⁢
          m
          ⁢
          
            
          
          ⁢
          such
          ⁢
          
            
          
          ⁢
          that
          ⁢
          
            
          
          ⁢
          the
        
        ⁢
        
          
        
      
    
  
  
    
      
        
          i
          ⁢
          
            -
          
          ⁢
          th
          ⁢
          
            
          
          ⁢
          digit
          ⁢
          
            
          
          ⁢
          of
          ⁢
          
            
          
          ⁢
          s
          ⁢
          
            
          
          ⁢
          is
          ⁢
          
            
          
          ⁢
          calculated
          ⁢
          
            
          
          ⁢
          as
          ⁢
          
            
          
          ⁢
          the
          ⁢
          
            
          
          ⁢
          exclusive
          ⁢
          
            
          
          ⁢
          OR
        
        ⁢
        
          
        
      
    
  
  
    
      
        
          between
          ⁢
          
            
          
          ⁢
          the
          ⁢
          
            
          
          ⁢
          i
          ⁢
          
            -
          
          ⁢
          th
          ⁢
          
            
          
          ⁢
          digits
          ⁢
          
            
          
          ⁢
          of
          ⁢
          
            
          
          ⁢
          p
          ⁢
          
            
          
          ⁢
          and
          ⁢
          
            
          
          ⁢
          q
          ⁢
          
            :
          
        
        ⁢
        
          
        
      
    
  
  
    
      
        
          
        
        ⁢
        
          p
          =
          
            (
            
              
                p
                0
              
              ,
              ...
              ⁢
              
                
              
              ,
              
                p
                
                  n
                  -
                  1
                
              
            
            )
          
        
      
    
  
  
    
      
        
          
        
        ⁢
        
          q
          =
          
            (
            
              
                q
                0
              
              ,
              ...
              ⁢
              
                
              
              ,
              
                q
                
                  n
                  -
                  1
                
              
            
            )
          
        
      
    
  
  
    
      
        
          s
          =
          
            
              p
              ⊕
              q
            
            =
            
              (
              
                
                  
                    (
                    
                      
                        p
                        0
                      
                      +
                      
                        q
                        0
                      
                    
                    )
                  
                  ⁢
                  
                    
                  
                  ⁢
                  mod
                  ⁢
                  
                    
                  
                  ⁢
                  2
                
                ,
                ...
                ⁢
                
                  
                
                ,
                
                  
                    (
                    
                      
                        p
                        
                          n
                          -
                          1
                        
                      
                      +
                      
                        q
                        
                          n
                          -
                          1
                        
                      
                    
                    )
                  
                  ⁢
                  
                    
                  
                  ⁢
                  mod
                  ⁢
                  
                    
                  
                  ⁢
                  2
                
              
              )
            
          
        
        )
      
    
  













The need to deal with an injective function comes from the requirement that UF is unitary. A unitary operator is reversible, so it cannot map two different inputs in the same output. Given that UF is the matrix representation of F, F is supposed to be infective. If the matrix representation of function f is directly used, a non-unitary matrix could be obtained since f could be non-injective. So, injectivity is fulfilled by increasing the number of bits and considering function F instead of function f. Function f can always be calculated from F by putting (y0, . . . , ym−1)=(0, . . . , 0) in the input string and reading the last m values of the output string.
Step 2: Function F map table is transformed into a UF map table, based upon the following constraint:

∀s∈{0,1}n+m: UF[τ(s)]=τ[F(s)]  (2)

The code map τ:{0,1}n+m→C2n+m (C2n+m is the target Complex Hilbert Space) is such that:

















  
    
      
        
          
            
              
                
                  τ
                  ⁡
                  
                    (
                    0
                    )
                  
                
                =
                
                  
                    (
                    
                      
                        
                          1
                        
                      
                      
                        
                          0
                        
                      
                    
                    )
                  
                  =
                  
                    
                      
                        
                        0
                        〉
                      
                      ⁢
                      
                        
                      
                      ⁢
                      
                        τ
                        ⁡
                        
                          (
                          1
                          )
                        
                      
                    
                    =
                    
                      
                        (
                        
                          
                            
                              0
                            
                          
                          
                            
                              1
                            
                          
                        
                        )
                      
                      =
                      
                        
                        1
                        〉
                      
                    
                  
                
              
            
          
          
            
              
                
                  τ
                  ⁡
                  
                    (
                    
                      
                        x
                        0
                      
                      ,
                      ...
                      ⁢
                      
                        
                      
                      ,
                      
                        x
                        
                          n
                          +
                          m
                          -
                          1
                        
                      
                    
                    )
                  
                
                =
                
                  
                    
                      τ
                      ⁡
                      
                        (
                        
                          x
                          0
                        
                        )
                      
                    
                    ⊗
                    
                      
                    
                    ⁢
                    ...
                    ⁢
                    
                      
                    
                    ⊗
                    
                      τ
                      ⁡
                      
                        (
                        
                          x
                          
                            n
                            +
                            m
                            -
                            1
                          
                        
                        )
                      
                    
                  
                  =
                  
                    
                    
                      
                        x
                        0
                      
                      ⁢
                      ...
                      ⁢
                      
                        
                      
                      ⁢
                      
                        x
                        
                          n
                          +
                          m
                          -
                          1
                        
                      
                    
                    〉
                  
                
              
            
          
        
         
      
    
    
      
        (
        3
        )
      
    
  






 






  
    
      
        
          
        
        ⁢
        
          BOX
          ⁢
          
            
          
          ⁢
          3
          ⁢
          
            :
          
          ⁢
          
            
          
          ⁢
          VECTOR
          ⁢
          
            
          
          ⁢
          TENSOR
          ⁢
          
            
          
          ⁢
          
            PRODUCT
            ⁢
            
              
            
            ⊗
          
        
      
    
  
  
    
      
        The
        ⁢
        
          
        
        ⁢
        tensor
        ⁢
        
          
        
        ⁢
        product
        ⁢
        
          
        
        ⁢
        between
        ⁢
        
          
        
        ⁢
        two
        ⁢
        
          
        
        ⁢
        vectors
        ⁢
        
          
        
        ⁢
        of
        ⁢
        
          
        
        ⁢
        dimensions
      
    
  
  
    
      
        
          h
          ⁢
          
            
          
          ⁢
          and
          ⁢
          
            
          
          ⁢
          k
          ⁢
          
            
          
          ⁢
          is
          ⁢
          
            
          
          ⁢
          a
          ⁢
          
            
          
          ⁢
          tensor
          ⁢
          
            
          
          ⁢
          product
          ⁢
          
            
          
          ⁢
          of
          ⁢
          
            
          
          ⁢
          dimension
          ⁢
          
            
          
          ⁢
          
            h
            ·
            k
          
        
        ,
        such
      
    
  
  
    
      
        that
        ⁢
        
          :
        
      
    
  
  
    
      
        
          
            
              
                
                  
                  x
                  〉
                
                ⊗
              
              
            
            ⁢
            y
          
          〉
        
        =
        
          
            
              (
              
                
                  
                    
                      x
                      1
                    
                  
                
                
                  
                    ...
                  
                
                
                  
                    
                      x
                      h
                    
                  
                
              
              )
            
            ⊗
            
              (
              
                
                  
                    
                      y
                      1
                    
                  
                
                
                  
                    ...
                  
                
                
                  
                    
                      y
                      k
                    
                  
                
              
              )
            
          
          =
          
            
              (
              
                
                  
                    
                      
                        x
                        1
                      
                      ⁢
                      
                        y
                        1
                      
                    
                  
                
                
                  
                    ...
                  
                
                
                  
                    
                      
                        x
                        1
                      
                      ⁢
                      
                        y
                        k
                      
                    
                  
                
                
                  
                    ...
                  
                
                
                  
                    
                      
                        x
                        h
                      
                      ⁢
                      
                        y
                        1
                      
                    
                  
                
                
                  
                    ...
                  
                
                
                  
                    
                      
                        x
                        h
                      
                      ⁢
                      
                        y
                        k
                      
                    
                  
                
              
              )
            
            ⇒
            
              
                
                  
                    
                      Physical
                      ⁢
                      
                        
                      
                      ⁢
                      interpretation
                      ⁢
                      
                        :
                      
                    
                    _
                  
                
              
              
                
                  
                    If  a  component of  a  complex
vector  is  interpreted  as  the
probability  amplitude  of  a 
system  in  a  given  state  (indexed
by  the  component  number),  the
tensor  product  between  two
vectors  describes  the  joint
probability  amplitude  of  two
systems  in  a  joint  state.
                  
                
              
            
          
        
      
    
  













EXAMPLES 
Vector Tensor Products




  
    
      
        
          
            
              
                
                  
                    
                      
                        
                          
                            (
                            
                              0
                              ,
                              0
                            
                            )
                          
                          ⁢
                          
                            ⟶
                            τ
                          
                          ⁢
                          
                            (
                            
                              
                                
                                  1
                                
                              
                              
                                
                                  0
                                
                              
                            
                            )
                          
                        
                        ⊗
                        
                          (
                          
                            
                              
                                1
                              
                            
                            
                              
                                0
                              
                            
                          
                          )
                        
                      
                      =
                      
                        
                          (
                          
                            
                              
                                1
                              
                            
                            
                              
                                0
                              
                            
                            
                              
                                0
                              
                            
                            
                              
                                0
                              
                            
                          
                          )
                        
                        =
                        
                          ❘
                          00
                        
                      
                    
                    〉
                  
                  ⁢
                  
                    
                  
                  ⁢
                  
                    
                      
                        (
                        
                          0
                          ,
                          1
                        
                        )
                      
                      ⁢
                      
                        ⟶
                        τ
                      
                      ⁢
                      
                        (
                        
                          
                            
                              1
                            
                          
                          
                            
                              0
                            
                          
                        
                        )
                      
                    
                    ⊗
                    
                      (
                      
                        
                          
                            0
                          
                        
                        
                          
                            1
                          
                        
                      
                      )
                    
                  
                
                =
                
                  
                    (
                    
                      
                        
                          0
                        
                      
                      
                        
                          1
                        
                      
                      
                        
                          0
                        
                      
                      
                        
                          0
                        
                      
                    
                    )
                  
                  =
                  
                    ❘
                    01
                  
                
              
              〉
            
            ⁢
            
              
            
            ⁢
            
              

            
            ⁢
            
              
                
                  
                    (
                    
                      1
                      ,
                      0
                    
                    )
                  
                  ⁢
                  
                    ⟶
                    τ
                  
                  ⁢
                  
                    (
                    
                      
                        
                          0
                        
                      
                      
                        
                          1
                        
                      
                    
                    )
                  
                
                ⊗
                
                  (
                  
                    
                      
                        1
                      
                    
                    
                      
                        0
                      
                    
                  
                  )
                
              
              =
              
                
                  (
                  
                    
                      
                        0
                      
                    
                    
                      
                        0
                      
                    
                    
                      
                        1
                      
                    
                    
                      
                        0
                      
                    
                  
                  )
                
                =
                
                  ❘
                  10
                
              
            
          
          〉
        
        ⁢
        
          
        
        ⁢
        
          
            
              (
              
                1
                ,
                1
              
              )
            
            ⁢
            
              ⟶
              τ
            
            ⁢
            
              (
              
                
                  
                    0
                  
                
                
                  
                    1
                  
                
              
              )
            
          
          ⊗
          
            (
            
              
                
                  0
                
              
              
                
                  1
                
              
            
            )
          
        
      
      =
      
        
          (
          
            
              
                0
              
            
            
              
                0
              
            
            
              
                0
              
            
            
              
                1
              
            
          
          )
        
        =
        
          ❘
          11
        
      
    
    〉
  
  ⁢
  
    
  




Code τ maps bit values into complex vectors of dimension 2 belonging to the canonical basis of C2. Besides using the tensor product, τ maps the general state of a binary string of dimension n into a vector of dimension 2n, for reducing this state to the joint state of the n bits composing the register. Every bit state is transformed into the corresponding 2-dimensional basis vector, and then the string state is mapped into the corresponding 2n-dimensional basis vector by composing all bit-vectors through tensor product. In this sense, the tensor product is the vector counterpart of a state conjunction.
Basis vectors are denoted using the ket notation |i>. This notation is taken from the Dirac description of quantum mechanics.
Step 3: UF map table is transformed into UF using the following transformation rule:

[UF]ij=1UF|j>=|i>  (4)

which can be easily understood considering vectors |i> and |j> as column vectors. Associating these vectors to the canonical basis, UF defines a permutation map of the identity matrix rows. In general, row |j> is mapped into row |i>. This rule will be illustrated in detail in an example quantum algorithm: Grover's algorithm.

The core of the quantum block is the quantum gate, which depends on the properties of matrix UF. The scheme in FIG. 3 gives a more detailed description of the quantum block. The matrix operator UF in FIG. 3 is the output of the encoder block represented in FIG. 2. Here, it becomes the input for the quantum block.
This matrix operator is first embedded into a more complex gate: the quantum gate G. Unitary matrix G is applied k times to an initial canonical basis vector |i> of dimension 2n+m. Every time, the resulting complex superposition G|0 . . . 01 . . . 1> of basis vectors is measured, and produces one basis vector |xi> as a result. All the measured basis vectors {|x1>, . . . , |xk>} are collected together. This collection is the output of the quantum block.
The intelligence of such algorithms is in the ability to build a quantum gate that is able to extract the information necessary to find the required property of f and to store it into the output vector collection. The structure of the quantum gate for every quantum algorithm will be discussed in detail, observing that a general description is possible. To represent quantum gates some special diagrams called quantum circuits are going to be used.
An example of a quantum circuit, relative to the so called Deutsch-Jozsa's quantum algorithm, is illustrated in FIG. 4. Every rectangle is associated to a 2n×2n matrix, where n is the number of lines entering and leaving the rectangle. For example, the rectangle marked UF is associated to matrix UF. Typically, matrix H represents a Hadamard rotation:




  
    
      
        H
        =
        
          
            1
            
              2
            
          
          ⁡
          
            [
            
              
                
                  1
                
                
                  1
                
              
              
                
                  1
                
                
                  
                    -
                    1
                  
                
              
            
            ]
          
        
      
    
    
      
        (
        5
        )
      
    
  




Quantum circuits provide a high-level description of the gate, and using some of the transformation rules are listed in FIGS. 5A–5F it is possible to compile them into the corresponding gate-matrix.
















  
    
      
        
          BOX
          ⁢
          
            
          
          ⁢
          4
          ⁢
          
            :
          
          ⁢
          
            
          
          ⁢
          MATRIX
          ⁢
          
            
          
          ⁢
          TENSOR
          ⁢
          
            
          
          ⁢
          
            PRODUCT
            ⁢
            
              
            
            ⊗
          
        
        _
      
    
  
  
    
      
        The
        ⁢
        
          
        
        ⁢
        tensor
        ⁢
        
          
        
        ⁢
        product
        ⁢
        
          
        
        ⁢
        between
        ⁢
        
          
        
        ⁢
        two
        ⁢
        
          
        
        ⁢
        matrices
        ⁢
        
          
        
        ⁢
        
          X
          
            n
            ×
            m
          
        
        ⁢
        
          
        
        ⁢
        and
        ⁢
        
          
        
        ⁢
        
          Y
          
            h
            ×
            k
          
        
      
    
  
  
    
      
        
          is
          ⁢
          
            
          
          ⁢
          a
          ⁢
          
            
          
          ⁢
          
            (
            block
            )
          
          ⁢
          
            
          
          ⁢
          matrix
          ⁢
          
            
          
          ⁢
          
            (
            
              n
              ·
              h
            
            )
          
          ×
          
            (
            
              m
              ·
              k
            
            )
          
          ⁢
          
            
          
          ⁢
          such
          ⁢
          
            
          
          ⁢
          that
          ⁢
          
            :
          
        
        ⁢
        
          
        
      
    
  
  
    
      
        
          X
          ⊗
          Y
        
        =
        
          
            
              [
              
                
                  
                    
                      
                        x
                        11
                      
                      ⁢
                      Y
                    
                  
                  
                    ...
                  
                  
                    
                      
                        x
                        
                          1
                          ⁢
                          m
                        
                      
                      ⁢
                      Y
                    
                  
                
                
                  
                    ...
                  
                  
                    ...
                  
                  
                    ...
                  
                
                
                  
                    
                      
                        x
                        n1
                      
                      ⁢
                      Y
                    
                  
                  
                    ...
                  
                  
                    
                      
                        x
                        nm
                      
                      ⁢
                      Y
                    
                  
                
              
              ]
            
            ⁢
            
              
            
            ⁢
            with
            ⁢
            
              
            
            ⁢
            X
          
          =
          
            [
            
              
                
                  
                    x
                    11
                  
                
                
                  ...
                
                
                  
                    x
                    
                      1
                      ⁢
                      m
                    
                  
                
              
              
                
                  ...
                
                
                  ...
                
                
                  ...
                
              
              
                
                  
                    x
                    n1
                  
                
                
                  ...
                
                
                  
                    x
                    nm
                  
                
              
            
            ]
          
        
      
    
  













EXAMPLE
Matrix Tensor Product:




  
    
      
        
          
            [
            
              
                
                  1
                
                
                  2
                
              
              
                
                  3
                
                
                  4
                
              
            
            ]
          
          ⊗
          
            [
            
              
                
                  5
                
                
                  6
                
              
              
                
                  7
                
                
                  8
                
              
            
            ]
          
        
        =
        
        ⁢
        
          [
          
            
              
                
                  
                    1
                    ·
                    
                      [
                      
                        
                          
                            5
                          
                          
                            6
                          
                        
                        
                          
                            7
                          
                          
                            8
                          
                        
                      
                      ]
                    
                  
                
              
              
                
                  
                    3
                    ·
                    
                      [
                      
                        
                          
                            5
                          
                          
                            6
                          
                        
                        
                          
                            7
                          
                          
                            8
                          
                        
                      
                      ]
                    
                  
                
              
            
            ⁢
            
              
            
            ⁢
            
              
                
                  
                    2
                    ·
                    
                      [
                      
                        
                          
                            5
                          
                          
                            6
                          
                        
                        
                          
                            7
                          
                          
                            8
                          
                        
                      
                      ]
                    
                  
                
              
              
                
                  
                    4
                    ·
                    
                      [
                      
                        
                          
                            5
                          
                          
                            6
                          
                        
                        
                          
                            7
                          
                          
                            8
                          
                        
                      
                      ]
                    
                  
                
              
            
          
          ]
        
      
    
  
  
    
      
        =
        
        ⁢
        
          [
          
            
              
                5
              
              
                6
              
              
                10
              
              
                12
              
            
            
              
                7
              
              
                8
              
              
                14
              
              
                16
              
            
            
              
                15
              
              
                18
              
              
                20
              
              
                24
              
            
            
              
                21
              
              
                24
              
              
                28
              
              
                32
              
            
          
          ]
        
      
    
  




It will be clearer how to use these rules when the first example of a quantum algorithm will be discussed in greater detail below.

The decoder block has the function to interpret the basis vectors collected after the iterated execution of the quantum block. Decoding these vectors means to retranslate them into binary strings and interpreting them directly if they already contain the answer to the starting problem or use them, for instance as coefficients vectors for an equation system, in order to get the searched solution. This part will not be investigated in detail because it is relatively straightforward to understand by those skilled in the art.
Because of the particular importance of the Grover's quantum algorithm in the realization of controllers and of data search algorithms in databases, a brief description of the Grover's algorithm is given. Grover's problem is stated as follows:
















Input
A function f: {0, 1}n → {0, 1} such that




∃x∈{0, 1}n:




(f(x) = 1 ∀y∈{0, 1}n: x ≠ y  f(y) = 0)



Problem
Find x










In Deutsch-Jozsa's algorithm there are two classes of input functions and it must be determined what class the input function belonged to. In this case the problem is almost identical in its form, even if it is more difficult because now we are dealing with 2n classes of input functions (each function of the kind described forms a class).
The diagram of the Grover's algorithm is depicted in FIG. 6, and the gate equation is as follows:

Φ=[(DnI)·UF]h·(n+1H)  (6)

Operator Dn is called a diffusion matrix of order n and it is responsible for interference in this algorithm. This matrix is defined as follows:


















Dn
|0 . . . 0>
|0 . . . 1>
. . . 
|i>
. . . 
|1 . . . 0>
|1 . . . 1>







|0 . . . 0>
−1 + 1/2n-1
1/2n-1
. . . 
1/2n-1
. . . 
1/2n-1
1/2n-1


|0 . . . 1>
1/2n-1
−1 + 1/2n-1
. . . 
1/2n-1
. . . 
1/2n-1
1/2n-1


. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .


|i>
1/2n-1
1/2n-1
. . . 
−1 + 1/2n-1
. . . 
1/2n-1
1/2n-1


. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .


|1 . . . 0>
1/2n-1
1/2n-1
. . . 
1/2n-1
. . . 
−1 + 1/2n-1
1/2n-1


|1 . . . 1>
1/2n-1
1/2n-1
. . . 
1/2n-1
. . . 
1/2n-1
−1 + 1/2n-1









Grover's algorithm may be implemented in routines for searching a desired item in a set, by representing in vector form each item of the set forming an input set of vectors, and by applying a Grover's algorithm to this set of vectors. The output vector represents the desired item.
The implementation of a Grover's algorithm clearly implies the calculation of several vector products. In fact, all qubits must be multiplied by matrix H, then by the entanglement matrix UF and all qubits but the latter must be multiplied by matrix Dn.
These multiplications could be carried out via software, but it is quite-evident that the number of qubits of a quantum algorithm could be very critical in terms of computational speed. In fact, referring to the scheme in FIG. 6, the addition of only one qubit doubles the dimensions of the matrices. Thus, the number of elements (and of products) increases exponentially.
A method of performing the superposition operation of a Grover's or of a Deutsch-Jozsa's quantum algorithm over an input set of vectors is disclosed in European patent application EP01830383.4, which is assigned to the current assignee of the present invention. This method exploits the fact that any rotated vector obtained performing the Hadamard rotation (on an input vector) contemplated by the superposition operation of these quantum algorithms can be easily encoded in a binary vector. Therefore, the successive tensor product of the rotated vectors for generating linear superposition vectors can be carried out by logic gates. This fact allows a noticeable time saving because logic gates are very fast.
However, this is not sufficient to significantly speed up these quantum algorithms because the entanglement matrix UF is a 2n+1×2n+1 square matrix, which implies a considerable computational weight both in the Grover's algorithm as well as in the Deutsch-Jozsa's algorithm.
SUMMARY OF THE INVENTION
An object of the present invention is to provide a method and a corresponding quantum gate for increasing the speed of performing entanglement operations in a Deutsch-Jozsa's or a Grover's quantum algorithm.
A large number of multiplications required by the entanglement operation gives a null result because only one component per row of the entanglement matrix UF is not a null. The entanglement operation generates an entanglement vector by permuting or not permuting a couple of opposite components of a linear superposition vector. This is dependent on the value assumed by the function f(.). More specifically, if function f(.) is null in correspondence to the vector identified by the first (leftmost) n qubits in common with the two n+1 qubit vectors to which a couple of opposite components of which the superposition vector is referred to, then the corresponding couple of components of the entanglement vector is equal to that of the superposition vector. Otherwise, it is the opposite.
Therefore, it is not necessary to calculate the entanglement matrix UF to generate an entanglement vector from a superposition vector. It is sufficient to copy or invert components of a superposition vector to generate corresponding components of an entanglement vector depending on the values of the function f(.) processed by the quantum algorithm.
More precisely, the object of the present invention is to provide a method of performing a Grover's or a Deutsch-Jozsa's quantum algorithm using a certain binary function defined on a space having a basis of vectors of n of qubits. The method may comprise carrying out a superposition operation over input vectors for generating components of linear superposition vectors referred on a second basis of vectors of n+1 qubits, carrying out an entanglement operation over components of the linear superposition vectors for generating components of numeric entanglement vectors, and carrying out an interference operation over components of the numeric entanglement vectors for generating components of output vectors.
The method allows a non-negligible time saving because the entanglement operation is carried out by generating, for components of each superposition vector, corresponding components of a numeric entanglement vector. Each component referred to a respective vector of the second basis is equal to the corresponding component of the respective superposition vector if the binary function is null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis; or the opposite of the corresponding component of the respective superposition vector if the binary function is not a null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis.
This method can be implemented in a quantum gate for running a Grover's or a Deutsch-Jozsa's quantum algorithm using a certain binary function defined on a space having a basis of vectors of n of qubits. The quantum gate may comprise a superposition subsystem carrying out a superposition operation over components of input vectors for generating components of linear superposition vectors referred on a second basis of vectors of n+1 qubits. An entanglement subsystem carries out an entanglement operation over components of the linear superposition vectors for generating components of numeric entanglement vectors. An interference subsystem carries out an interference operation over components of the numeric entanglement vectors for generating components of output vectors.
The entanglement subsystem may comprise a command circuit generating a number (2n) of logic command signals encoding the values of the binary function in correspondence to the vectors of the first basis. Circuit means may be input with the logic command signals that generate, for components of each superposition vector, corresponding signals representing components of a numeric entanglement vector.
Each component referred to a respective vector of the second basis may be equal to the corresponding component of the respective superposition vector if the binary function is null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis; or the opposite of the corresponding component of the respective superposition vector if the binary function is not a null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis.



BRIEF DESCRIPTION OF THE DRAWINGS
The particular aspects and advantages of the invention will become more evident through the following description of several important embodiments and by referring to the attached drawings, wherein:
FIG. 1 is a block diagram of a quantum algorithm in accordance with the prior art;
FIG. 2 is a block diagram of an encoder in accordance with the prior art;
FIG. 3 is a general structure of the block diagram illustrated in FIG. 1;
FIG. 4 is a circuit for a Deutsch-Jozsa's quantum gate in accordance with the prior art;
FIG. 5a shows an example of a tensor product transformation in accordance with the prior art;
FIG. 5b shows an example of a dot product transformation in accordance with the prior art;
FIG. 5c shows the identity transformation in accordance with the prior art;
FIG. 5d shows an example of the propagation rule in accordance with the prior art;
FIG. 5e shows an example of the iteration rule in accordance with the prior art;
FIG. 5f explains the input/output tensor rule in accordance with the prior art;
FIG. 6 is an example of a circuit forming a Grover's quantum gate in accordance with the prior art;
FIG. 7 is a graph of a function to be processed by a Grover's quantum algorithm in accordance with the present invention;
FIG. 8 is a detailed view of a superposition subsystem of the quantum gate in accordance with the present invention for a Grover's algorithm with one iteration;
FIG. 9 depicts the logic part of the entanglement subsystem of a quantum gate in accordance with the present invention for the function illustrated in FIG. 7;
FIG. 10 is a detailed view of the entanglement subsystem of the quantum gate in accordance with the present invention for a Grover's algorithm with one iteration;
FIG. 11 is a detailed view of the interference subsystem of the quantum gate in accordance with the present invention for a Grover's algorithm with one iteration.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
The quantum gate of the invention is suitable for fast running decision making or data search routines based on a Deutsch-Jozsa's or a Grover's quantum algorithm applied over a set of input vectors. The quantum gate of a superposition subsystem carrying out a linear superposition, an entanglement subsystem carrying out an entanglement operation and an interference subsystem carrying out an interference operation according to a Grover's or a Deutsch-Jozsa's quantum algorithm.
An essential characteristic of the quantum gate of the invention includes the fact that the entanglement subsystem does not multiply a superposition vector for the entanglement matrix UF, but generates components of an entanglement vector simply by copying or inverting respective components of the superposition vector depending on values of the function f(.).
This allows a relevant reduction of the number of multiplications with respect to known methods, and can be carried out with logic gates or multiplexers. For this reason, the quantum gate of the invention may be conveniently used for running decision making algorithms or data search routines in large databases in a very fast manner.
To show how the calculation of an entanglement vector can be speeded up by the method of the invention, an example of quantum search algorithm in which each vector is composed of two qubits is given. The present invention supports the extension to vectors of more than two qubits, as readily appreciated by those skilled in the art.
Let us consider a function f: {0,1}2→{0,1} having the following definition law:




  
    
      
        {
        
          
            
              
                
                  f
                  ⁡
                  
                    (
                    01
                    )
                  
                
                =
                1
              
            
          
          
            
              
                
                  f
                  ⁡
                  
                    (
                    .
                    )
                  
                
                =
                
                  0
                  ⁢
                  
                    
                  
                  ⁢
                  elsewhere
                
              
            
          
        
      
    
    
      
        (
        7
        )
      
    
  




whose diagram is depicted in FIG. 7. According to known methods, this function should be translated into a function F: {0,1}3→{0,1}3 and, therefore into the matrix UF:





  
    
      
        
          U
          F
        
        =
        
          [
          
            
              
                I
              
              
                0
              
              
                0
              
              
                0
              
            
            
              
                0
              
              
                C
              
              
                0
              
              
                0
              
            
            
              
                0
              
              
                0
              
              
                I
              
              
                0
              
            
            
              
                0
              
              
                0
              
              
                0
              
              
                I
              
            
          
          ]
        
      
    
    
      
        (
        8
        )
      
    
  




where





  
    
      
        I
        =
        
          
            
              [
              
                
                  
                    1
                  
                  
                    0
                  
                
                
                  
                    0
                  
                  
                    1
                  
                
              
              ]
            
            ⁢
            
              
            
            ⁢
            C
          
          =
          
            [
            
              
                
                  0
                
                
                  1
                
              
              
                
                  1
                
                
                  0
                
              
            
            ]
          
        
      
    
    
      
        (
        9
        )
      
    
  




The following linear superposition will now be considered:





  
    
      
        
          Y
          *
        
        =
        
           
          
             
            
              [
              
                
                  
                    
                      1
                      
                        2
                        ⁢
                        
                          2
                        
                      
                    
                  
                  
                    
                      -
                      
                        1
                        
                          2
                          ⁢
                          
                            2
                          
                        
                      
                    
                  
                  
                    
                      1
                      
                        2
                        ⁢
                        
                          2
                        
                      
                    
                  
                  
                    
                      -
                      
                        1
                        
                          2
                          ⁢
                          
                            2
                          
                        
                      
                    
                  
                  
                    
                      1
                      
                        2
                        ⁢
                        
                          2
                        
                      
                    
                  
                  
                    
                      -
                      
                        1
                        
                          2
                          ⁢
                          
                            2
                          
                        
                      
                    
                  
                  
                    
                      1
                      
                        2
                        ⁢
                        
                          2
                        
                      
                    
                  
                  
                    
                      
                        
                          -
                          
                            1
                            
                              2
                              ⁢
                              
                                2
                              
                            
                          
                        
                        ]
                      
                      T
                    
                  
                
              
            
          
        
      
    
    
      
        (
        10
        )
      
    
  




Known methods contemplate generating components of the corresponding entanglement vector G*:





  
    
      
        
          G
          *
        
        =
        
           
          
            [
            
              
                
                  
                    1
                    
                      2
                      ⁢
                      
                        2
                      
                    
                  
                
                
                  
                    -
                    
                      1
                      
                        2
                        ⁢
                        
                          2
                        
                      
                    
                  
                
                
                  
                    -
                    
                      1
                      
                        2
                        ⁢
                        
                          2
                        
                      
                    
                  
                
                
                  
                    1
                    
                      2
                      ⁢
                      
                        2
                      
                    
                  
                
                
                  
                    1
                    
                      2
                      ⁢
                      
                        2
                      
                    
                  
                
                
                  
                    -
                    
                      1
                      
                        2
                        ⁢
                        
                          2
                        
                      
                    
                  
                
                
                  
                    1
                    
                      2
                      ⁢
                      
                        2
                      
                    
                  
                
                
                  
                    
                      
                        -
                        
                          1
                          
                            2
                            ⁢
                            
                              2
                            
                          
                        
                      
                      ]
                    
                    T
                  
                
              
            
          
        
      
    
    
      
        (
        11
        )
      
    
  




by calculating the product G*=UF·Y*, which implies many (64) multiplications.

According to the method of the invention, the components of the vector G* are more easily obtained by copying or inverting the corresponding components of Y*, depending on the values assumed by the function f(.). More precisely, all components of vector G* but the third and the fourth are equal to the corresponding components of Y* because the function f(.) is 0 for vectors |00>, |10> and |11>, while the third and the fourth components of G* are obtained by inverting the corresponding components of Y* because f(.) is 1 for vector |01>. As a consequence, the entanglement operation of Deutsch-Jozsa's or Grover's quantum algorithms can be implemented in straightforward and fast quantum gates.
A particular quantum gate of the invention, especially designed for carrying out the Deutsch-Jozsa's quantum algorithm or the Grover's algorithm with only one iteration (h=1), is depicted in FIGS. 8, 10 and 11. This quantum gate has a superposition subsystem, which can be as depicted in FIG. 8 and as disclosed in the above referenced European patent application EP01830383.4. The quantum gate further includes an entanglement subsystem made of logic gates and operational amplifiers, and an interference subsystem.
This particular embodiment of a quantum gate exploits the fact that the vector Y* can be encoded by using the transformation:




  
    
      
        Y
        =
        
          
            1
            
              2
              ⁢
              y
            
          
          ·
          
            (
            
              
                Y
                *
              
              +
              
                
                  [
                  
                    y
                    ⁢
                    
                      
                    
                    ⁢
                    ...
                    ⁢
                    
                      
                    
                    ⁢
                    y
                  
                  ]
                
                T
              
            
            )
          
        
      
    
    
      
        (
        12
        )
      
    
  




where





  y
  =
  
    1
    
      2
      ⁢
      
        2
      
    
  




in the following encoded superposition vector:

Y=[10101010]T  (13)

It is easy to demonstrate that the vector G that encodes the entanglement vector G*=UF·Y* according to the cited transformation (equation 12)





  
    
      
        G
        =
        
          
            1
            
              2
              ⁢
              y
            
          
          ·
          
            (
            
              
                G
                *
              
              +
              
                
                  [
                  
                    y
                    ⁢
                    
                      
                    
                    ⁢
                    ...
                    ⁢
                    
                      
                    
                    ⁢
                    y
                  
                  ]
                
                T
              
            
            )
          
        
      
    
    
      
        (
        14
        )
      
    
  




is G=UF·Y. Therefore, components gi of the encoded entanglement vector G can be obtained, according to the method of the invention, by copying or inverting the corresponding components yi of the encoded superposition vector Y, depending on the values of function f(.). For the considered example, the encoded entanglement vector G is

G=[10011010]T  (15)

which corresponds to the numeric entanglement vector given by equation 11.

An example of a logic circuit for carrying out the entanglement operation of a Grover's or Deutsch-Jozsa's algorithm is depicted in FIG. 9. Each logic gate XORs a component of the encoded superposition vector yi with a corresponding value of the function f(.) for generating a corresponding component gi of encoded entanglement vector. Each component yi that is not a null is represented by a voltage of 3.5V, while each null component is represented by a null voltage.
The components of the encoded entanglement vector are then converted in corresponding components d1, . . . , d8 of a numeric entanglement vector by an array of digital/analog converters, depicted in FIG. 10. Each converter includes an adder that inverts the transformation given by equation 14. The output voltages d1, . . . d8 of the operational amplifiers are about ±0.3535 Volts, which corresponds to a numeric value of




  ±
  
    
      1
      
        2
        ⁢
        
          2
        
      
    
    .
  




A more difficult task is to deal with the interference operation of a Grover's algorithm. In fact, differently from the entanglement operation, vectors generated by the interference operation are not composed by elements having only two possible values. Moreover, the presence of tensor products, whose number increases dramatically with the dimensions, forms a critical point at this step.
It is possible to quickly carry out the interference operation of a Grover's quantum algorithm. The matrix DnI has the following properties:

    
    
        odd columns (or rows, because DnI is symmetric) have non-zero odd components and even columns have non-zero even components;
        the value of all non-zero components, but the ith component of ith column (diagonal elements) is 1⁄2n−1. The components on the up-left down-right diagonal of the matrix differ from the other non-zero components because they are decreased by 1; and
        since G* is the numeric entanglement vector, the output vector of the quantum algorithm V=(DnI) G* involves only a suitable weighted sum of components of G*, with the value 1⁄2n−1 depending only from the number n of qubits.
    
    


From the above analysis, the generic element vi of V can be written as follows as a function of g*i:




  
    
      
        
          v
          i
        
        =
        
          {
          
            
              
                
                  
                    
                      1
                      
                        2
                        
                          n
                          -
                          1
                        
                      
                    
                    ⁢
                    
                      
                        ∑
                        
                          j
                          =
                          1
                        
                        
                          2
                          n
                        
                      
                      ⁢
                      
                        g
                        
                          
                            2
                            ⁢
                            j
                          
                          -
                          1
                        
                        *
                      
                    
                  
                  -
                  
                    g
                    i
                    *
                  
                
              
              
                
                  for
                  ⁢
                  
                    
                  
                  ⁢
                  i
                  ⁢
                  
                    
                  
                  ⁢
                  odd
                
              
            
            
              
                
                  
                    
                      1
                      
                        2
                        
                          n
                          -
                          1
                        
                      
                    
                    ⁢
                    
                      
                        ∑
                        
                          j
                          =
                          1
                        
                        
                          2
                          n
                        
                      
                      ⁢
                      
                        g
                        
                          2
                          ⁢
                          j
                        
                        *
                      
                    
                  
                  -
                  
                    g
                    i
                    *
                  
                
              
              
                
                  for
                  ⁢
                  
                    
                  
                  ⁢
                  i
                  ⁢
                  
                    
                  
                  ⁢
                  even
                
              
            
          
        
      
    
    
      
        (
        16
        )
      
    
  




Therefore, in order to calculate a component vi of the output vector it is sufficient to calculate a weighted sum of even





  (
  
    
      1
      
        2
        
          n
          -
          1
        
      
    
    ⁢
    
      
        ∑
        
          j
          =
          1
        
        
          2
          n
        
      
      ⁢
      
        g
        
          2
          ⁢
          j
        
        *
      
    
  
  )




or odd





  (
  
    
      1
      
        2
        
          n
          -
          1
        
      
    
    ⁢
    
      
        ∑
        
          j
          =
          1
        
        
          2
          n
        
      
      ⁢
      
        g
        
          
            2
            ⁢
            j
          
          -
          1
        
        *
      
    
  
  )




components of the numeric entanglement vector, and to subtract from it the corresponding component g*i of the numeric entanglement vector.

According to the above formulas, the pre-interference sum block of the interference subsystem depicted in FIG. 11 has adders generating voltage signals representing scaled sums of odd (s1) and even (s2) components with a scale factor of 1⁄2n−1 (0.5 in this case). The interference subsystem further comprises an array of adders input with a voltage representing a component of the numeric entanglement vector (d1, . . . , d8) and with a respective scaled sum (s1 or s2) for generating voltages representing components (i1, . . . , i8) of the output vector.
When the Grover's algorithm terminates, only two of them (i3, i4) may assume values close to




  
    
      ±
      
        1
        
          2
        
      
    
    =
    
      ±
      0.7071067
    
  
  ,




denoting the position of the searched element. With the same entanglement as in the previous section, third and fourth OPAMPs (i3 and i4) must have non-zero values. This fact is confirmed by the PSPICE simulation depicted in FIG. 11 (707 mV against 0.1 mV of other outputs).

As evident to one skilled in the art, the computational speed is significantly increased because of a smaller number of products (only one for each element of the output vector), and more precisely 2n+1 against 4n+1 of traditional approaches. Even the number of additions has been reduced (2n(2n+1) instead of 4n+1). But the most important fact is that all these operations can be easily carried out via hardware with few operational amplifiers (2n+2) . Moreover, if n is the number of qubits (in the considered example n=2), this embodiment of a quantum gate of the invention calculates only 2n+1 products (8) instead of 22n+2 (64) required in prior art methods, thus noticeably reducing the time required for carrying out the entanglement operation.
It is not necessary to calculate all the components of the entanglement or output vector because the odd components of any vector are always opposite the even components, and it is possible to infer looking at signals d1, d3, d5, d7 and i1, i3, i5, i7. Therefore, it is clear that the number of logic gates or adders in FIGS. 10 and 11 could have been halved simply by carrying out the entanglement and interference operations only on the odd or even components, and by calculating the other components by inverting the first ones.

## Claims

1. A method of operating a quantum gate running a Grover's quantum algorithm, the method comprising:
receiving at an input of the quantum gate a binary function having a basis of vectors of n qubits;
carrying out a superposition operation using a superposition subsystem coupled to the input, the superposition operation being carried out on input vectors for generating components of linear superposition vectors based upon a second basis of vectors of n+1 qubits;
carrying out an entanglement operation using an entanglement subsystem coupled to the superposition subsystem, the entanglement operation being carried out on components of the linear superposition vectors for generating components of numeric entanglement vectors, the entanglement operation generating, for components of each superposition vector, corresponding components of a numeric entanglement vector, each component based upon a respective vector of the second basis and being equal to one of the following
the corresponding component of the respective superposition vector if the binary function is null based upon the vector of the first basis formed by the first n qubits of the respective vector of the second basis, and
the opposite of the corresponding component of the respective superposition vector if the binary

function is not a null; and
carrying out an interference operation using an interference subsystem coupled to the entanglement subsystem, the interface operation being carried out on components of the numeric entanglement vectors for generating components of output vectors.

2. A method according to claim 1, wherein the components of each output vector are even components, and odd components of each output vector are obtained by inverting the even components.

3. A method according to claim 1, wherein the components of each output vector are odd components, and even components of each output vectors are obtained by inverting the odd components.

4. A method according to claim 1, wherein even or odd components of a numeric entanglement vector are obtained by carrying out the following operations:
encoding components of each linear superposition vector with a low logic value if negative and with a high logic value if positive for generating components of encoded superposition vectors;
generating for components of each encoded superposition vector corresponding components of an encoded entanglement vector, each component based upon a respective vector of the second basis and being obtained by
copying the corresponding component of the respective encoded superposition vector if the binary function is null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis, or
logically inverting the corresponding component of the respective encoded superposition vector if the binary function is not a null; and

decoding the components of encoded entanglement vectors for generating the components of numeric entanglement vectors.

5. A method according to claim 4, wherein each of the components of an encoded entanglement vector is obtained by XORing the corresponding component of the encoded superposition vector with a value of the binary function corresponding to the vector of the first basis formed by the first n qubits.

6. A method according to claim 1, wherein the interference operation comprises:
calculating a weighed sum with a scale factor of even or odd components of a numeric entanglement vector; and
generating each even or odd component of an output vector by respectively subtracting a corresponding even or odd component of a numeric entanglement vector from the weighed sum.

7. A method of operating a quantum gate running a Deutsch-Jozsa's quantum algorithm, the method comprising:
receiving at an input of the quantum gate a binary function having a basis of vectors of n gubits;
carrying out a superposition operation using a superposition subsystem coupled to the input, the superposition operation being carried out on input vectors for generating components of linear superposition vectors based upon a second basis of vectors of n+1 qubits;
carrying out an entanglement operation using an entanglement subsystem coupled to the superposition subsystem, the entanglement operation being carried out on components of the linear superposition vectors for generating components of numeric entanglement vectors, the entanglement operation generating, for components of each superposition vector, corresponding components of a numeric entanglement vector, each component based upon a respective vector of the second basis and being equal to one of the following
the corresponding component of the respective superposition vector if the binary function is null based upon the vector of the first basis formed by the first n qubits of the respective vector of the second basis, and
the opposite of the corresponding component of the respective superposition vector if the binary function is not a null; and

carrying out an interference operation using an interference subsystem coupled to the entanglement subsystem, the interface operation being carried out on components of the numeric entanglement vectors for generating components of output vectors.

8. A method according to claim 7, wherein the components of each output vector are even components, and odd components of each output vector are obtained by inverting the even components.

9. A method according to claim 7, wherein the components of each output vector are odd components, and even components of each output vectors are obtained by inverting the odd components.

10. A method according to claim 7, wherein even or odd components of a numeric entanglement vector are obtained by carrying out the following operations:
encoding components of each linear superposition vector with a low logic value if negative and with a high logic value if positive for generating components of encoded superposition vectors;
generating for components of each encoded superposition vector corresponding components of an encoded entanglement vector, each component based upon a respective vector of the second basis and being obtained by
copying the corresponding component of the respective encoded superposition vector if the binary function is null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis, or
logically inverting the corresponding component of the respective encoded superposition vector if the binary function is not a null,!and

decoding the components of encoded entanglement vectors for generating the components of numeric entanglement vectors.

11. A method according to claim 10, wherein each of the components of an encoded entanglement vector is obtained by XORing the corresponding component of the encoded superposition vector with a value of the binary function corresponding to the vector of the first basis formed by the first n qubits.

12. A quantum gate for running a Grover's quantum algorithm and comprising:
an input for receiving a binary function having a basis of vectors of n qubits;
a superposition subsystem connected to the input for carrying out a superposition operation on components of input vectors for generating components of linear superposition vectors based upon a second basis of vectors of n+1 qubits;
an entanglement subsystem connected to said superposition subsystem for carrying out an entanglement operation on components of the linear superposition vectors for generating components of numeric entanglement vectors, said entanglement subsystem comprising
a command circuit generating a plurality of logic command signals encoding values of the binary function corresponding to the vectors of the first basis, and
circuit means being input with the logic command signals and generating for components of each superposition vector corresponding signals representing components of a numeric entanglement vector, each component referred to a respective vector of the second basis is equal to at least one of the following
the corresponding component of the respective superposition vector if the binary function is null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis, and
the opposite of the corresponding component of the respective superposition vector if the binary function is not a null; and


an interference subsystem connected to said entanglement subsystem for carrying out an interference operation on components of the numeric entanglement vectors for generating components of output vectors.

13. A quantum gate according to claim 12, wherein said circuit means encodes components of each linear superposition vector with a low logic value if negative and with a high logic value if positive for generating signals representing components of an encoded superposition vector, said circuit means comprising:
an array of XOR logic gates each input with a signal representing a component of an encoded superposition vector, and with a relative logic command signal for generating voltage signals representing components of encoded entanglement vectors; and
an array of digital/analog converters that decodes components of the encoded entanglement vectors for generating signals representing corresponding components of numeric entanglement vectors.

14. A quantum gate according to claim 13, wherein each digital/analog converter outputs a signal representing the weighed difference with a second scale factor between the component of encoded entanglement vectors and a reference value.

15. A quantum gate according to claim 12, wherein said interference subsystem comprises:
an adder being input with voltage signals representing even or odd components of a numeric entanglement vector, and generating a summed signal representing a weighed sum with a scale factor of the even or odd components; and
an array of adders each being input with a respective signal representing an even or odd component, respectively, of a numeric entanglement vector and with the summed signal for generating a signal representing an even or odd component, respectively, of the output vector as the difference between the summed signal and the signal representing an even or odd component of a numeric entanglement vector.

16. A quantum gate for running a Deutsch-Jozsa's quantum algorithm and comprising:
an input receiving a binary function having a basis of vectors of n qubits;
a superposition subsystem connected to the input for carrying out a superposition operation on components of input vectors for generating components of linear superposition vectors based upon a second basis of vectors of n+1 qubits;
an entanglement subsystem connected to said superposition subsystem for carrying out an entanglement operation on components of the linear superposition vectors for generating components of numeric entanglement vectors, said entanglement subsystem comprising
a command circuit generating a plurality of logic command signals encoding values of the binary function corresponding to the vectors of the first basis, and
a circuit being input with the logic command signals and generating for components of each superposition vector corresponding signals representing components of a numeric entanglement vector, each component referred to a respective vector of the second basis is equal to at least one of the following
the corresponding component of the respective superposition vector if the binary function is null in correspondence to the vector of the first basis formed by the first n qubits of the respective vector of the second basis, and
the opposite of the corresponding component of the respective superposition vector if the binary function is not a null; and


an interference subsystem connected to said entanglement subsystem for carrying out an interference operation on components of the numeric entanglement vectors for generating components of output vectors.

17. A quantum gate according to claim 16, wherein said circuit encodes components of each linear superposition vector with a low logic value if negative and with a high logic value if positive for generating signals representing components of an encoded superposition vector, said circuit comprising:
an array of XOR logic gates each input with a signal representing a component of an encoded superposition vector, and with a relative logic command signal for generating voltage signals representing components of encoded entanglement vectors; and
an array of digital/analog converters that decodes components of the encoded entanglement vectors for generating signals representing corresponding components of numeric entanglement vectors.

18. A quantum gate according to claim 17, wherein each digital/analog converter outputs a signal representing the weighed difference with a second scale factor between the component of encoded entanglement vectors and a reference value.