• No se han encontrado resultados

Bottom-up approach to Build a Quantum Sampler

In document facultad de ingeniería y computación (página 35-40)

have their own qubit assigned: qa, qb and qy respectively. Each assigned qubit represents the sign.

Therefore, ha, hb can be set equal to a and b respectively, and hy to 0 since we do not known its sign. Moreover, we can also set Jay = |a| and Jby = |b| since qa and qb both want qy to have the same sign as theirs. However, since |a|<|b|, qy must obey qb

sign so that the overall ISING is minimized.

This idea can therefore be applied to represent summation architecture which in- cludes intrinsically an activation function(see Figure 4.2), and that works with an arbitrary number of operands.

Figure 4.2: Architecture 0: represents the sum of 3 variables in order to get the sigmoid value of a random binary variable yi. FF stands for ”force field”.

.

• If the sign is negative, a positive force field has to be applied to a qubit so it can be forced to have a value of -1.

• Otherwise apply negative force field.

Let’s denote these input qubits as I1 and I2, and the output qubit as qo. Then, the above intuition leads to the need of building an XNOR gate since this gate will, eventually, allow qo to be 1 if I1 and I2 are equal, otherwise it should be equal to -1.

Even though, using a NOR gate is also valid (since it is just a matter of playing with an inversed output), an XNOR gate can be constructed more efficiently.

According to [DWave, 2018], every boolean circuit can be built on a quantum com- puter. Therefore, the rules to entangle and to set the force field of input and output qubits of an XNOR quantum gate should be seek.

Figure 4.3: Boolean circuit of logic NAND.

.

Figure 4.4: Architecture 1: Architecture that represents a logical NAND. At the left-hand side the reader can see how qubits are displayed following the letter notation of 4.3. At the right-hand side the force fields in each circle, and the coupling values near the edges is being displayed.

.

An XNOR gate can be built with 3 NAND gates according to Figure 4.3. A NAND gate, denoted as Architecture 1, can be built without ancillas as shown in Figure 4.4.

The explanation of this architecture and considerations are given next:

• A and B are input qubits, and C is the output qubit of a relative NAND gate.

• Input qubits need to have a larger absolute-valued force field applied than the output qubit. This is why, intuitively 2 is chosen as the force field of input qubits and

-1 for the output qubit. This is because input qubits seek to ”influence” the output qubit.

• The reason why input qubits are being divided by their absolute value is because those qubits are only representing signs (at least by the moment).

• The couplers are set to 1 because this is how the energy function can be minimized when di↵erent signs are received.

• The output qubit receives a force field of -1 because if the output qubit is set to 0, then the energy function is equal when both signs are the same, so in order to get an energy less than 0 when both sign are negative, the output qubit is set to -1.

The proof of correctness of quantum NAND gates is straightforward:

Proof. Let qa, qb, qr be the qubits that represent A, B, and the result qubits respectively.

Following Fig. 4.4, then ISIN Gnand = 2qa 2qb qr +qaqr +qbqr. The following scenarios are given:

• qa and qb have a +1 spin. ThenISIN Gnand= 4 +qr and its ground state is when qr <0.

• qa and qb have a 1 spin. ThenISIN Gnand = 4 qr and its ground state is when qr >0.

• qaand qb have di↵erent spins. ThenISIN Gnand= qrand its ground state is when qr >0.

Once having a defined quantum NAND gate, a XNOR gate can be built. This works very straightforward: just entangle output qubits of the leftmost NANDs (Figure 4.3) as if these were input qubits (i.e. setting coupler values of these two with the final output to 1), and initialize with proper force fields A, B and their negations according to the signs of the input.

4.2.2 Building Matrix Multiplication

What follows next is to represent a row ofW multiplied by a column ofX. However before going through these rules is important to take into consideration the following facts:

• The absolute value of the force fields of input qubits in XNOR gates have to dominate output qubits.

• Since the multiplication is made of a real number (W) and ones (xi), then it have to only take care of which number does W has.

Figure 4.5: Intuition of Architecture 2. This image represents a multiplication between 2 numbers (in which one of them is either 0 or 1), and an addition of a bias to this multiplication.

.

• According to the sum representation (i.e. Architecture 0), the coupling values be- tween the qubits that represent the multiplication between X and W have to be proportionally to the same, and the same applies to the elements of the vector of biases.

According to various test a workingArchitecture 2can be built to represent matrix multiplication with the following rules:

1. For each multiplication:

(a) Apply XNOR gates to the operand of the current multiplication according to Architecture 1 to build this gate.

(b) Since it has to proportionally imply the energies in the objective function, and input qubits have to be greater, the input qubits are multiplied by twice the absolute value of the respective W value.

(c) Each output qubit in the NAND gates of the XNOR gate is multiplied by the absolute value of the respective W value.

(d) Entangle the first two NAND gates by setting a coupling value of C XNOR.

This will force this qubits to have an equal state and the reason of doing so is because of the nature of XNOR gate.

2. Following Architecture 0, entangleyi with proportional coupling values, andbi with the output qubit of the various XNOR gate.

3. The target variable,yi, is in perfect superposition state.

Without loss of generality, an intuition of this architecture can be seen in Figure 4.5 since it display the major components. When more multiplications are added, XNOR gates are built following the rules comprised in point one, and entangle the output qubit of the XNOR gates to y according to rule 2.

4.2.3 Choosing One Value

Once matrix multiplication is done, it will give all the elements of vector Y. There can be various ones, but the overall approach to RNNs require to only have one, and the strongest should dominate.

Intuitively, we can think to entangle all elements of y with a coupler value greater than 0.

In [Nguyen et al., 2014] a method for feature selection is developed. However the useful part of this [Nguyen et al., 2014], is the approach taken to choosek features, since the method proposed in our work seeks to select k = 1 elements of y. This approach states that the following equation is useful:

P =↵

|y|

X

i=1

(yi k)2. (4.7)

In Equation 4.7 P can be described as a penalization function and must be added to the overall QUBO model.

In 4.7 ↵ must be chosen. The author states that given a sufficiently large alpha then the quadratic function can guarantee that solutions with a di↵erent number k = 1 ones will be no longer minima. From this equation it can be inferred that the approach followed so far can be still used. This can also be validated with DWave’s function dimod.generators.combinations(), and by setting the parameterstrength=↵.

By runningdimod.generators.combinations() it is seen that the coupling val- ues are set twice the strength, and that every yi must be entangled to the other |Y| 1 elements. Moreover, each yi is set to |↵|, but later test will determine if force fields on each yi should be applied since these can a↵ect the architectures developed so far.

In document facultad de ingeniería y computación (página 35-40)

Documento similar