Quantum Analog-Digital Conversion

Quantum Analog-Digital Conversion

Kosuke Mitarai mitarai@qc.ee.es.osaka-u.ac.jp Graduate School of Engineering Science, Osaka University, 1-3 Machikaneyama, Toyonaka, Osaka 560-8531, Japan.    Masahiro Kitagawa Graduate School of Engineering Science, Osaka University, 1-3 Machikaneyama, Toyonaka, Osaka 560-8531, Japan.    Keisuke Fujii fujii.keisuke.2s@kyoto-u.ac.jp Graduate School of Science, Kyoto University, Yoshida-Ushinomiya-cho, Sakyo-ku, Kyoto 606-8302, Japan. JST, PRESTO, 4-1-8 Honcho, Kawaguchi, Saitama 332-0012, Japan
July 13, 2019

Many quantum algorithms, such as Harrow-Hassidim-Lloyd (HHL) algorithm, depend on oracles that efficiently encode classical data into a quantum state. The encoding of the data can be categorized into two types; analog-encoding where the data are stored as amplitudes of a state, and digital-encoding where they are stored as qubit-strings. The former has been utilized to process classical data in an exponentially large space of a quantum system, where as the latter is required to perform arithmetics on a quantum computer. Quantum algorithms like HHL achieve quantum speedups with a sophisticated use of these two encodings. In this work, we present algorithms that converts these two encodings to one another. While quantum digital-to-analog conversions have implicitly been used in existing quantum algorithms, we reformulate it and give a generalized protocol that works probabilistically. On the other hand, we propose an deterministic algorithm that performs a quantum analog-to-digital conversion. These algorithms can be utilized to realize high-level quantum algorithms such as a nonlinear transformation of amplitude of a quantum state. As an example, we construct a “quantum amplitude perceptron”, a quantum version of neural network, and hence has a possible application in the area of quantum machine learning.

Valid PACS appear here

I Introduction

A wide variety of quantum algorithms have been proposed that potentially give quantum speedups over classical computers. The problems that are efficiently solved by existing quantum algorithms can be divided into two types; ones where input data of a problem is relatively small in size but the problem itself is hard classically, and ones where input of a problem is exponentially large, making it hard to handle on classical computers. The formers are solved by algorithms such as Shor’s factoring Shor (1997), or quantum chemistry calculations Kassal et al. (2011). On the other hand, there are algorithms that solve problems categorized as the latter. They achieve quantum speedups only if an oracle that encodes classical data in time exists Aaronson (2015). A famous example is Harrow-Hassidim-Lloyd (HHL) algorithm Harrow et al. (2009), which executes a linear transformation represented by a matrix on a -dimensional vector . It requires us to construct a quantum state:


where normalized to satisfy . Data encoding in the format of Eq. (1) is crucial for all HHL-based algorithms Schuld et al. (2016); Yu et al. (2017); Rebentrost et al. (2014); Wiebe et al. (2012), and others Wiebe et al. (2015); Lloyd et al. (2013). We will call the state of Eq. (1) as an “analog-encoded” state, since data are encoded into analog quantities, that is, complex amplitudes of a quantum state. Here we define an analog-encoding unitary transformation by:


Another approach is to encode -bits of binary data into qubit-strings. Let and (, ) be the number of binary data provided and the data bitstrings. In this approach, a data-encoded quantum state is constructed as follows:


We will call this state as a “digital-encoded” state. For example, quantum algorithms for solving semidefinite programs (SDPs) Brandao and Svore (2017); Brandão et al. (2017) depends on this encoding. Similarly to an analog-encoding unitary transformation, we define a digital-encoding unitary transformation by


is often called quantum random access memory (QRAM). Refs. Giovannetti et al. (2008a, b) have provided a protocol which employs qutrits to speedup a memory call to two-body interaction gates. Their method is promising compared to a conventional method that requires operations. It might be worth noting that in the context of QRAM, it is usually assumed that we already have “memory cells” which stores data in the form accessible from a quantum computer.

Many quantum algorithms sophisticatedly use these two types of encodings. For example, in HHL algorithm Harrow et al. (2009), an analog-encoded state Eq. (1) is put through quantum phase estimation algorithm that digitally encode eigenvalues of a matrix , and then the inverse of them are multiplied to the amplitudes by controlled rotations (Fig. 1 (b)); in quantum metropolis sampling Temme et al. (2011), energy eigenvalue of a Hamiltonian is first digitally encoded by the phase estimation, and then the encoded energies are transferred to amplitudes in the form of , again using controlled rotations.

In this paper, we investigate the relation of these two different encoding methods. Specifically, we concentrate on conversions between these two encodings; can you go from “digital-encoding” to “analog-encoding” (quanutm digital-to-analog conversion, QDAC), or other way around (quantum analog-to-digital conversion, QADC)? DAC and ADC play important roles in classical information processing, since digitally-stored data are easier to handle than analog data which physical systems generate and are driven by. QDAC and QADC can be regarded as quantum analogues of them, and therefore there is a possibility that they stimulate the construction of more sophisticated quantum algorithms. First we formulate these problems. It is shown that QDAC can be implemented probabilistically, and QADC deterministically. A special case of QDAC, in fact, has implicitly been employed in existing algorithms such as HHL and quantum metropolis samplings. We unify those techniques and give a generalized procedure. QDAC and QADC algorithms provide an insight of what should be done in digital- or analog-encodings. Also, as an application, we show that a QADC-QDAC combined method can be utilized to perform almost arbitrary nonlinear transformations of amplitudes of a quantum state. This result can be utilized, for example, for a purpose of constructing quantum machine learning algortihms.

Figure 1: (a) Schematic sketch of analog-encoding and digital-encoding. QDAC and QADC mediates these two encodings. (b) A brief flowchart of HHL algorithm Harrow et al. (2009). denote eigenvectors of an Hermitian matrix , each corresponding to eigenvalues . are complex numbers such that .

This paper is organized as follows. First in Sec. II, we summarize the algorithms we use as subroutines and define QADC and QDAC problem. In Sec.III, we review QDAC procedures that has implicitly been utilized in existing algorithms. We also present the generalized QDAC procedure. Then in Sec.IV, we present an algorithm to perform QADC. In Sec. V, we provide applications of QADC, and show that QADC combined with QDAC provides us a way to perform a nonlinear transformation of amplitudes of a quantum state.

Ii Preliminary

Here we summarize some useful results from existing works along with definitions of terms. Throughout this paper denotes the number of data.

Fact 1 (analog encoding unitary Kerenidis and Prakash (2017))

For given classical data , a binary-tree like classical data structure can be constructed in time on a classical computer. With this structure, there exists a quantum algorithm that constructs an analog-encoding unitary with single- and two-qubit gates.

We use the phase estimation algorithm stated below as a key ingredient of our QADC algorithm.

Fact 2 (phase estimation Cleve et al. (1998))

Let be a unitary operator acting on -qubit Hilbert space with eigenstates and corresponding eigenvalues where . Let for some positive integer . There exists a quantum algorithm, which consists of controlled- calls and single- and two-qubit gates, that performs transformation where denotes a bitstring such that for all with state fidelity at least .

We say that has fidelity with when . The phase estimation algorithm can also be viewed as a digital-encoding unitary transformation, where address is replaced by eigenstates of .

Next we state a version of the amplitude amplification technique.

Fact 3 (amplitude amplification Brassard et al. ())

Suppose we have a unitary operator that acts on -qubit Hilbert space as where are arbitrary -qubit states. Then probability of getting can be made close to unity by application of .

Finally, we define QDAC and QADC as follows.

Definition 1 (Qdac)

Let be a set of real numbers in , each of which is represented by with binary variables . Let denote the -bit string . An -bit QDAC operation transforms digital-encoded state to where is a normalization constant. It may be done both deterministically or nondeterministically.

Definition 2 (Qadc)

Let be real numbers such that and . Let denote the -bit string that best approximates by . An -bit QADC operation transforms analog-encoded state to . It may be done both deterministically or nondeterministically.

We use quantum arithmetics as a subroutine, which is stated as the following theorem.

Fact 4 (quantum arithmetics Ruiz-Perez and Garcia-Escartin (2017))

Let be -bit strings. There exists a quantum algorithm that performs transformation or with single- and two-qubit gates.

Note that for accuracy defined as , quantum arithmetics scales as . Furthermore, we assume the following statement as a fact.

Fact 5

Some basic functions such as inverse, trigonometric functions, square root, and inverse trigonometric functions can be calculated to accuracy , that is, we can perform a transformation such that where is the objective function, using quantum arithmetics.

A similar title is found on Ref. Schmüser and Janzing (2005). However, their purpose was to map a continuous-space wave function to a discrete-space wave function . In the context of this paper, it can be viewed as analog-to-analog conversion.

Iii Qdac

It is actually straightforward to create an analog-encoded state from a digital-encoded state; you can do it just by adding an ancilla qubit and performing a controlled rotation with the data register. In fact, this QDAC procedure has implicitly used in existing works. For example, HHL Harrow et al. (2009) has utilized the above protocol to multiply inverse of eigenvalues of an Hermitian matrix to an analog-encoded state vector. We state this QDAC operation formally as a theorem below.

Theorem 1 (QDAC with ancilla)

There exists a quantum algorithm that performs -bit QDAC using single- and two-qubit gates and one , where , with probability .

Proof - The procedure of algorithm is as follows. Assume that we are provided with a digital-encoded state Eq. (3).

  1. Compute by quantum arithmetics.


    where denotes -bit strings such that .

  2. Adding an ancilla qubit , perform a controlled rotation on the ancilla.

  3. Measure the ancilla in computational basis. With probability , we obtain


    where .

  4. Uncompute (step 1) and apply . We now have an analog-encoded state


Now we analyze the complexity. On step 1, can be calculated with quantum arithmetics using gates by Fact. Step 2 uses controlled rotations. Therefore, overall complexity for steps 1, 2 and 4 is and one . The success probability of step 3 is .

Success probability of above procedure can be rewritten in terms of the mean and the variance of the data, since . Note that, when and the success probability is relatively small, the amplitude amplification technique can be utilized to shorten the expected running time quadratically from to .

When one modifies Step 1 to give , we readily obtain the following.

Corollary 1.1 (generalized QDAC)

There exists a quantum algorithm that performs the transformation such that , where is a function satisfying Fact 5, using single- and two-qubit gates, with probability .

It can be generalized further. If we use ancilla qubit, and follow the same procedure as above, we obtain


Although the success probability decays exponentially to , it provides us a way to encode a highly-nonlinear function in the amplitudes. Quantum neuron proposed in Ref. Cao et al. () has employed a method somewhat similar to a special case of Eq. (9), but not completely comparable, to get nonlinearlity. If we choose , Collorary 1.1 provides an alternative way to implement a sigmoid function.

Iv Qadc

Here we propose an QADC algorithm.

Theorem 2 (Qadc)

There exists an -bit QADC algorithm that runs using controlled- gates and single- and two-qubit gates with output state fidelity , where .

Proof - First we provide the algorithm. (See Fig. 2 for steps 1-4.)

  1. Prepare address qubits.

  2. Perform controlled-NOT from the address qubits to initialized ancilla qubits (We will call them qubits A) to get .

  3. Prepare the analog-encoded state in data qubits.

  4. Now using another ancilla qubit (We will call it qubit B), perform a swap test Buhrman et al. (2001) without measurement between data-qubit and qubits A (Fig. 2). We have:


    Fig. 2 shows the quantum circuit from step 1 to step 4. We define to be the combined unitary transformation of step 3 and 4. Note here that amplitude of is for each . This step extracts an amplitude each corresponding to an address . The same idea is also used from Ref. Zhou et al. (2017).

  5. Construct a gate


    where is a conditional phase shift gate; and is a Pauli gate only acting on the qubit B (Fig. 3). Each is decomposed into two of eigenstates and of , which respectively have eigenvalue where and . The decomposition is: . Brassard et al. ()

  6. Introducing the register qubits, run the phase estimation of as depicted in Fig.4. Then we have:


    where and are -bit strings that store and as binary data.

  7. On another register, using digital quantum arithmetics, calculate . Note that , and is uniquely recovered since we have assumed . Then finally we get:

  8. Uncompute the data, A, B, reg’ qubits. We obtain:


    which is a digital-encoded state.

Here we analyze the complexity of the above algorithm. For steps 1 to 4, we used single- and two-qubit gate. On step 5, the phase estimation, we need to use of controlled- and of single- and two-qubit gate. Step 6, quantum arithmetics takes by Fact 5. Therefore, overall complexity is of controlled- and of single- and two-qubit gate. The fidelity of the output state is by Fact 2

Figure 2: A quantum circuit through steps 1 to 4 of QADC in the main text.
Figure 3: Definition of gate in QADC.
Figure 4: Step 6 of the QADC algorithm. The phase estimationa is performed to encode the analog-encoded value into qubit bitstrings. IQFT is inverse quantum Fourier transformation Nielsen and Chuang (2010).

V applications

v.1 Classical data loading

As stated in the introduction, there are some algorithms, such as quantum SDP solvers Brandao and Svore (2017); Brandão et al. (2017), that require an oracle which encodes classical data into a quantum state Eq. (3) in time .

QADC can be utilized for this purpose. Assume that a binary-tree structure required in Fact 1 is already constructed on classical side. Combined with the analog-encoding unitary of Fact 1, the -bit digital-encoded state can be prepared with quantum gates.

Recently another method for digital encoding has been proposed Cortese and Braje (2018). They proposed a protocol that directly encodes binary classical data into qubits.

v.2 Nonlinear transformation of amplitude

The transformation performed on the probability amplitudes of a quantum state , without measurements, is always linear owing to the unitarity of the quantum dynamics. Even with (projective) measurement, the transformation is restricted to the form of , where C is some constant that is determined by normalization condition. Therefore, a transformation of the form with an aribitrary function cannot be done, without encoding them in digital form using QADC. We state the fact that this form of nonlinear transformation of amplitude can be performed using QADC and QDAC as following theorem.

Theorem 3

Let data , where , analog-encoding unitary and analog-encoded state be given. For any function that satisfies Fact 5, there exists a probabilistic quantum algorithm that performs transformation , such that , with controlled- gates and single- and two-qubit gates. Probability of success is and the output state fidelity is

Proof - The QADC algorithm from Theorem 2 provides us a state using controlled- gates and single- and two-qubit gates with state fidelity . Then performing the modified QDAC from Corollary 1.1, we get with single- and two-qubit gates and with probability . Finally, application of inverse QADC leaves us the desired state.

The most useful application of this would be to deal with a “quantum big-data”. For example, using on two registers, we can prepare


is not restricted to the loading of classical data , but can also be a time evolution operator , where is some Hamiltonian which can efficiently be simulated on a quantum computer. Notice that the tensor product structure of quantum mechanics has calculated the product and the combined system has of amplitudes. This nonlinearity is employed in quantum circuit learning Mitarai et al. () for machine learning application. The direct digital encoding of these dimensional data on a quantum state might be impractical, since the calculation of the product takes time and space classically. In comparison, the construction of the quantum state Eq. (16) requires only classical and quantum operations. Tensor product structure is useful to introduce nonlinearity to the data in the form of Eq. (16), however, it cannot be used to introduce general and more complex transformation stated in above theorem.

Applying QADC on this combined state yields a state,


Note that this transformation can also be performed in time . Then applying the nonlinear QDAC procedure and the inverse of QADC, one gets,


which has nonlinearly transformed probability amplitudes. Further extension is discussed in the next subsection.

v.3 Quantum amplitude perceptron

When one chooses or with any sigmoid function , it can readily mimic the perceptron that is frequently used in neural networks. In neural network, a transformation of the form , where and are a weight vector and a data vector, is utilized to learn some task. The training of the network is done by tuning the weight to give some specific output. To mimic this, first we apply a parametrized unitary transformation , which corresponds to the weight , on a analog-encoded state , yielding a state . Note that the amplitude can be a resultant amplitude after the tensor product multiplication described in previous section. Then use the procedure of Theorem 3 with the sigmoid function , which produces,


The squaring of occurs because is not always positive and hence the step 7 of presented QADC algorithm has to be modified. The full tomograhy of this state would require us an exponential time, but if one is interested in costant number of perceptron outputs, performing a swap test Buhrman et al. (2001) with chosen basis is enough to extract them. The state Eq. (19) can be further transformed by some unitary gates to determine the readout weight of the output.

For machine learning, it is necessary to optimize the parameter . Although the gradient of the output with respect to cannot be extracted due to the complex form of Eq. (19), gradient-free method can be utilized, just as same as mentioned in Ref. Cao et al. ().

Finally, we note here, if one can determine the value of somehow, amplitude amplification technique can be employed to make QDAC procedure deterministic. This would enable us to implement multilayer neural network on a quantum computer deterministically.

Vi Conclusion

We have formulated QDAC and QADC, and described algorithms to implement them on quantum computers. Although QDAC protocols have implicitly been utilized in existing algorithms, we have generalized it to facilitate complex nonlinear functions. We have also presented an algorithm that performs QADC. It was shown that a combination of QADC and QDAC enables us almost arbitrary nonlinear transformations of amplitudes of a quantum state. The possible application of this nonlinear transformation is to make a quantum amplitude perceptron, which can be employed to construct more sophisticated quantum machine learning algorithms.

KM would like to thank Makoto Negoro for fruitful discussions. KF is supported by KAKENHI No. 16H02211, JST PRESTO JPMJPR1668, JST ERATO JPMJER1601, and JST CREST JPMJCR1673.


Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description