text:
# Quantum recognition of eigenvalues, structure of devices and thermodynamic properties

## 1 Electronic devices and quantum computations

### 1.1 Statements of problems and outline of the work

The aim of this paper is to build effective quantum algorithms for the problems of the following types:

* Given a quantum gate array generating unitary operator $`U`$ and a complex number $`\omega `$ how to determine is it an eigenvalue of $`U`$ or not (precision of determining eigenvalues is fixed)?
* How to recognize a structure of unknown electronic or molecular device given only access to its function?

Here the first problem will be an important intermediate step in the solution of the second 111A straightforward calculation shows that the simulation of evolution generated by a given Hamiltonian up to a time instant $`\tau `$ with a fixed accuracy requires of order $`\tau ^2`$ steps on a quantum computer. This means that all results of the paper can be generalized to arbitrary quantum systems. This subject will be elaborated in more details in another paper.. Consider them sequentially.

Recognition of eigenvalues. This problem is closely connected with finding of eigenvalues distribution or density of states (DOS) that is energy levels $`E_0<E_1<\mathrm{}`$ and dimensions of the corresponding subspaces $`d_0,d_1,\mathrm{}`$. DOS plays a key role in calculation of thermodynamic functions given by

$$F=\underset{j}{}a(j)d_je^{\frac{E_j}{k_BT}}$$
(1)
for some values $`a(j)`$ so that the summands quickly converge to zero. Say, if all $`a(j)=1`$ this expression gives the partition function $`Q`$, if $`a(j)=E_j/Q`$ it gives an average energy, if $`a(j)=\frac{k_B}{Q}\mathrm{ln}(e^{E_j/k_BT}/Q)`$ \- an entropy. Having an efficient method of finding $`d_j`$ we would be able to obtain thermodynamic functions and to determine important properties of environment consisting of such molecules like heat capacity. The best known classical method of finding DOS was proposed by Hams and Raedt in the work \[HR\]. Their method requires the time of order dimension $`N`$ of the space of states and the memory of the same order (whereas the direct method of calculation eigenvalues requires the time of order $`N^3`$). The first quantum algorithm for this problem proposed by Abrams and Lloyd in \[AL\] requires the same time $`O(N)`$ and logarithmic memory. The method proposed in the present work requires the time of order square root of classical and memory of order $`\mathrm{ln}^2N`$.

The idea of our approach is the following. We shall use combination of Grover search algorithm (GSA), revealing eigenvalues by Abrams and Lloyd method (\[AL\]) and universal quantum function of application $`\mathrm{App}`$. Abrams and Lloyd method of revealing eigenvalues is based on the application of $`U`$ controlled by ancillary qubit $`\alpha `$ as

$$U_{cond}|x,\alpha \{\begin{array}{cc}|Ux,\alpha ,& \text{if}\alpha =1,\\ |x,\alpha & \text{if}\alpha =0.\end{array}$$

Note that it is the direct generalization of Shor’s trick which can be obtained if $`U`$ is a multiplication by a given integer modulo $`q`$ (\[Sh\]).

Recognition of devices structure.

We shall tell apart two versions of this general problem: the recognition of molecular structures and the recognition of electronic circuits.

If we want to determine a molecular structure then it is natural to assume that its functionality is given as the spectrum of its Hamiltonian, e.g. the set of its energy levels. Thus here it is required to find a quantum system whose Hamiltonian has a given spectrum.

The problem of recognition of electronic circuits is stated otherwise. An electronic device is thought of as a source of electromagnetic fields which can control some quantum system $`Q`$. Let such a field induces evolution of the system with Hamiltonian $`H`$ in time frame $`\delta t`$. Thus we have a correspondence: electronic device $``$ Hamiltonian, $`\delta t`$. Evolution of a quantum system $`Q`$ induced by this Hamiltonian can be presented as a unitary transform $`U=e^{\frac{i}{h}H\delta t}`$. Then, given a device $`C`$ and a value of time $`t`$ we can associate with it some unitary transformation $`U_C`$. Assume that we have recognized a circuit $`C`$ if we find some circuit $`C_1`$ such that $`U_C=U_{C_1}`$ with high accuracy. We shall write $`U`$ instead of $`U_C`$ for the circuit $`C`$ that we want to recognize. But in fact we shall solve the more general problem when a tested device $`C`$ can be used as a black box acting on $`n`$ qubits as a function $`U_C`$ so that if $`x`$ is an input then $`U_C|x`$ is a result of its action on this input. Here a tested device can contain its own quantum memory and it can be entangled with $`Q`$ in course of fulfilling $`U`$ but this entanglement must be then eliminated. The existence of such entanglement means that this case cannot be described by the Hamiltonian of system $`Q`$. For the simplicity we assume that an unknown circuit is built of elementary functional elements from some fixed set $`\{E_1,E_2,\mathrm{},E_o\}`$. The next natural assumption is that a size of circuit is limited by some constant $`c`$ so that our circuit is some unknown combination of $`c`$ functional elements. Denote by $``$ all circuits of the length $`c`$. We can encode such $`C`$ by a string $`[C]`$ of ones and zeroes so that decoding procedure is easy as well and we can immediately recreate a circuit given its code. Thus we can look through all circuits looking through its codes. The same coding can be built for electronic devices.

A straightforward solution of the problems is clear. For the problem of recognition of molecular structures all that we need is to be able to recognize eigenvalues of transformation generated by a given circuit. Each eigenvalue of unitary operator has the form $`e^{2\pi i\omega }`$ where $`\omega `$ is a real number from $`[0,1)`$ called frequency. In what follows by spectrum we mean a set of all frequencies. Let all frequencies are grouped near points of the form $`\frac{l}{M}`$ where $`M`$ is not very big, $`l=0,1,\mathrm{},M1`$. Assume that the acceptable precision of recognition of frequencies is $`1/M`$. Then having an algorithm for eigenvalue recognition we can apply it again and again constructing spectrums generated by all possible circuits and thus find a wanted circuit with given spectrum. If we need to recognize a circuit of electronic device we can examine all possible circuits taken in some order. Examination of one circuit means that we run it on all possible inputs one after another and compare the results with the corresponding result of a tested device action.

For the problem of recognition of molecular structures our method requires the time of order sixth root of the time of direct classical method whereas memory saving is exponential. For the problem of recognition of electronic circuits our method gives at least square root time saving in the case when classical counterparts exist (this is the narrow formulation when a tested device generates classical mapping). But in general case an advantage may be more. For example we can tell apart two devices with the same spectrum in the time about seventh root of the time of naive bruit force.

To recognize devices quantumly we must be able to store and fulfill operations on the codes of different circuits. This possibility is based on the existence of a quantum analog of the universal Klini function. This is a unitary operator $`\mathrm{App}`$ such that for all quantum devices $`C`$ and all inputs $`x`$ $`\mathrm{App}|x,[C]=|U_Cx,[C]`$. We assume that for the wide range of quantum devices $`C`$ with $`c`$ particles $`C`$ may be encoded as integer $`[C]`$ in time $`O(c)`$ so that the quantum complexity of $`\mathrm{App}`$ is $`O(c)`$ as well.

We shall consider here a particular case of the problem when all eigenvalues of $`U`$ are known a-priori or can be obtained beforehand. This restriction is not yet very constraining. To illustrate what kind of tasks we shall be able to solve by the proposed method consider a few examples of the problem of recognition of an electronic device whose spectrum is known.

Recognition of quantum algorithms designed as subroutines. Such algorithms must restore an input if we apply it twice. Computing a function $`f`$ they act as $`|x,b|x,b+f(x)\mathrm{mod}2`$. All known quantum algorithms can be presented in such form. For such quantum algorithms their unitary transformation $`U`$ has only two eigenvalues: $`1`$ and $`1`$. Given a controlling device for such algorithm (it may include classical elements and ancillary qubits as well) we can quickly recognize its construction. Alternatively, we can quickly find quantum or classical algorithm for a given task.

Consider a ”classical” particular case of the recognition problem when $`U`$ maps each basic state to a basic state which means that the matrix of $`U`$ consists of ones and zeroes and in addition $`U`$ equals $`U^1`$. Here evident strategy of recognition takes of order $`\mathrm{card}()2^n`$ steps. This case of the problem may be reformulated as the finding of such $`t`$ that for all $`s`$ some given predicate $`A(t,s)`$ is true. This is the problem of verification of logical formulas. Quantum solution of it in a time about square root of classical time based plainly on Grover’s trick was proposed in \[BCW\]. This method doesn’t work in the general case where $`U_C`$ is arbitrary involutive unitary transform, e.g. such that $`U=U^1`$. Just this general case is the subject of this work. Here we cannot recognize a circuit so easy as in ”classical” case because it is difficult to compare two quantum states $`U_C|x`$ and $`U|x`$.

The general idea of our approach to the recognition of arbitrary electronic devices is the following. We shall include a device $`C`$ which structure we want to recognize into a classical controlling part of quantum computer. Thus a tested device generates unitary transformation on $`n`$ qubit system. Then reveal eigenvectors of $`U`$ using $`U_{cond}`$ by the method mentioned above and compare them with eigenvectors of circuits from $``$ choosing a circuit giving the best approximation. Here GSA will be used in the last step and in the several intermediate steps.

Assumption about sparse spectrum

In this paper we shall consider mainly circuits generating sparse spectrums. It means that spectrums of operators $`U_C`$ are so designed that the frequencies are grouped into groups such that a minimal distance between frequencies from the different groups is more than $`1/M`$ and a maximal distance between frequencies from the same group is less than $`1/L`$. For the problems of eigenvalues and molecular structures recognition we require that $`L=16M`$ that is not yet very restricting. For the recognition of electronic devices we shall suppose $`LM`$ that is more strong limitation. Spectrums are called sparse if $`M=const`$ when $`N\mathrm{}`$. For sparse spectrums our algorithms show the best performance.

Spectrums that are not sparse are called dense. For dense spectrums our methods give the less advantage over classical algorithms (look at section 3.6). An example of dense spectrum: $`\omega _k=\frac{k}{N},k=0,1,\mathrm{},N1`$. The similar problems for dense spectrums will be studied in one of the following papers.

We write $`\omega ^{}\omega `$ iff $`\omega ^{}`$ and $`\omega `$ belong to the same group. For the simplicity assume also that for each group of frequencies there exists a number of the form $`l/M`$ disposed between some two frequencies of this group where $`l`$ is an integer less than $`M`$.

### 1.2 An abstract model of QC. ”Plug and play” technology

To build algorithms recognizing circuits we need an abstract model of quantum computer (QC). QC consists of two parts: quantum and classical. Classical part exactly determines what unitary transformation must be fulfilled at each time instant with quantum part and thus plays a role of controller for it. These unitary transformations are of two sorts: working transformations - which our computer performs itself and query transformations - induced by a tested device: $`U`$ or $`U_{cond}`$.

We can suppose that a quantum part $`Q`$ consists of nuclear spins or interacting dipoles (or some other quantum two levels systems) and a classical part is a source of electromagnetic fields determining evolution of a quantum part. The general form of a state of quantum part will be $`\chi =\underset{i=0}{\overset{2^\nu 1}{}}\lambda _ie_i`$ where the basic states of it $`e_0,\mathrm{},e_{2^\nu 1}`$ are simply strings of ones and zeroes of the length $`\nu `$ where $`\nu >n`$ is the size of quantum part which can contain some auxiliary qubits behind input for $`U`$, $`\underset{i=0}{\overset{2^\nu 1}{}}|\lambda _i|^2=1`$, $`N=2^n`$ is the number of all classical input words for $`U`$.

Classical part determines when to ”switch on” a tested device (usually it happens many times) and when to observe a result of computation. Observation of a state $`\chi `$ gives every basic state $`e_i`$ with the corresponding probability $`|\lambda _i|^2`$.

The problem of recognition of electronic devices presumes the so-called ”plug and play” technology where a tested device is applied only as a black box. If query transformations are only $`U`$ then our model evidently satisfies requirements of ”plug and play” technology where we classically control when to switch on a tested device. An implementation of $`U_{cond}`$ in the framework of this technology is not so easy because it requires a quantum control on applications of the device 222This would be evidently possible provided we have access to the internal details of our device and can quantumly control their work simultaneously. But this assumption contradicts to ”plug and play” technology.. Nevertheless it is possible to implement $`U_{cond}`$ in the framework of ”plug and play” technology. This possibility will be substantiated in the following papers. Now we shall simply presume that it is possible. Such difficulty does not exist for the problems of eigenvalue and molecular structures recognition. Here we can manage without oracles at all because having an explicit form of a quantum gate array realizing a universal function of application $`\mathrm{App}`$ we can quantumly control its actions in each element separately and simultaneously thus implementing $`U_{cond}`$.

Let every basic state be partitioned as:
$`e_i=|\text{place for code}[C],R_{\overline{1}},R_{\overline{2}},\mathrm{},R_{\overline{l}}`$, where each register $`R_{\overline{i}}`$ in its turn is partitioned into a place for argument, places for time instants and places for the corresponding frequencies. Here a complex index $`\overline{i}`$ contains one or two integers so that the length of $`e_i`$ is polynomial of $`c`$ and $`n`$ of at most second degree.

## 2 Obtaining new algorithms from basic quantum tricks

### 2.1 GSA and amplitude amplification

GSA proposed in (\[Gr\]) is one of two basic quantum tricks. It is meant for quick getting of a quantum state $`\overline{a}`$ given the inversion along this state $`I_{\overline{a}}`$. An inversion along some state $`\overline{a}`$ is defined by

$$I_{\overline{a}}|\overline{x}=\{\begin{array}{cc}|\overline{x},& \text{if}xa,\\ |\overline{a},& \text{if}x=a.\end{array}$$

We also assume that $`I_{\overline{a}}`$ acts like identity if $`\overline{a}`$ does not exist. A typical situation is when a state is unknown but the inversion along it can be fulfilled easily. Say, let $`\overline{a}`$ be a solution of equation $`f(x)=1`$ with a simply computable Boolean function $`f`$. Then the inversion $`I_{\overline{a}}`$ can be implemented by addition modulo 2 of $`f(x)`$ to an ancillary qubit initialized by $`\frac{|0|1}{\sqrt{2}}`$. This transformation maps a state $`|x,\frac{|0|1}{\sqrt{2}}`$ to the same state with the sign + or $``$ subject to the satisfaction of equality $`f(x)=1`$. The transformation is unitary and can be easily fulfilled given a device fulfilling $`f`$. All sequential transformations in our formulas will be applied from right to left.

GSA is sequential applications of the transformation $`G=I_{\overline{a}}I_{\stackrel{~}{0}}`$ to a state $`\stackrel{~}{0}`$ which is chosen randomly beforehand. If we apply this transformation $`O(\sqrt{N})`$ times where $`N`$ is the dimension of main space then an observation of quantum part yields $`\overline{a}`$ with visible probability whereas without quantum computer we would be compelled to spend of order $`N`$ steps to find $`\overline{a}`$.

A little difficulty here is that we don’t know exactly a time instant $`t`$ when to stop iterations to make probability of error negligible that is needed when applying GSA as subroutine. Here the following simple trick helps.

Define a number $`B=B(N)`$ so that $`1/B`$ is an average value of $`|a|\stackrel{~}{0}|`$ for $`\stackrel{~}{0}`$ uniformly distributed on a sphere of radius 1 in the space of inputs. A straightforward calculation shows that $`B=O(\sqrt{N})`$. Let $`\mathrm{GenArg}_j`$ be operators generating arbitrary vectors $`\overline{a}_j`$ from the space of inputs belonging to independent uniform distributions, $`j\{1,2,\mathrm{},k\}`$, and let $`\mathrm{GenTimeArg}_j`$ be operators generating time instants $`t_j`$ from independent uniform distributions on integers from the segment $`[0,B]`$. Arrange $`k`$ copies of two working registers: for input and for storage of a time instant and fulfill the corresponding operator $`(I_{\stackrel{~}{0}}I_{\overline{a}})^{t_j}\mathrm{GenArg}_j\mathrm{GenTime}_j`$ on each register. Now if $`\overline{a}`$ exists then the probability to obtain $`\overline{a}`$ observing any one register is at least 1/4 (it is shown in \[BBHT\]) and the probability to obtain any fixed other state will be negligible because our operators $`\mathrm{GenArg}_j`$ generate independent uniformly distributed samples. If $`\overline{a}`$ does not exist which means that $`I_{\overline{a}}`$ is identity then the probability to obtain any fixed state will be negligible. Denote by $`\overline{a}_j`$ the contents of $`j`$-th register for argument in the resulting state. Consider the following criterion: if at least one fifth of $`\overline{a}_j,j=1,2,\mathrm{},k`$ coincide then we decide that $`\overline{a}`$ is this value, if not then $`\overline{a}`$ does not exist. Calculate the error probability of this criterion. Let $`K`$ be a number of such $`j`$ that $`\overline{a}_j=\overline{a}`$. By the central limit theorem the probability that a fraction $`\frac{(k/4)K}{\sqrt{(k/4)(3/4)}}`$ belongs to the segment $`[\alpha _1,\alpha _2]`$ is closed to $`\frac{1}{\sqrt{2\pi }}\underset{\alpha _1}{\overset{\alpha _2}{}}e^{\frac{x^2}{2}}𝑑x`$. Then the straightforward calculations give that the probability of that $`Kk/5`$ will be of order $`\underset{\alpha _1}{\overset{\mathrm{}}{}}e^{\frac{x^2}{2}}𝑑x`$ for $`\alpha _1`$ of order $`\sqrt{k}`$. Thus to make error probability of order $`1/\sqrt{N}`$ it would suffice to choose $`k`$ of order $`n=\mathrm{log}N`$. This method can be used not only for GSA but also for other algorithms. If a probability to obtain a right result for each of $`k`$ registers is some positive $`p`$ which does not depend on the dimensionality then to make this probability $`1/N_1`$ it is sufficient to choose $`k`$ of order $`\mathrm{log}N_1`$. In what follows we shall use this simple trick without special mentioning and will mark the simultaneous operations of the same kind on all working registers by $`\underset{j}{}`$. We assume that all ensembles generated by the different $`j`$-th copies of operators are taken from the independent distributions.

We shall use the standard norm on operators in Hilbert space defined by $`A=\underset{\overline{x}=1}{sup}A\overline{x}`$. Given an operator $`A`$ denote by $`A_ϵ`$ such operator $`A^{}`$ that $`AA^{}ϵ`$. In what follows we shall use a simple trick described above making necessary copies of registers and so will raise an accuracy of our operators up to required level. When we must repeat an operator $`T`$ times the required accuracy of one application must be $`1/T`$ and it may be ensured by only linear price in memory as it was shown above. This means that we shall always use $`A_ϵ`$ instead of $`A`$ without special mentioning where $`ϵ=O(1/T)`$ if an operator $`A`$ must be repeated $`T`$ times.

### 2.2 Revealing of eigenvalues

The second basic quantum trick is designed to reveal eigenvalues of a given unitary operator $`U`$. We shall define an operator revealing frequencies in accordance to the work \[AL\].

Let $`M=2^m,L=2^p`$. We are going to determine frequencies of unitary operators in within $`1/L`$ where $`L`$ is a number of applications of $`U`$ required for the revelation of frequencies with this accuracy which means that $`1/M`$ is an accuracy that is sufficient to tell apart eigenvalues of $`U`$. For the recognition of eigenvalues we put $`p=m+4`$ so that $`L=16M`$.

Denote by $`(0.l)_p`$ a number from $`[0,1)`$ of the form $`l/L`$. Let an operator $`U`$ have eigenvalues $`e^{2\pi i\omega _k}`$ where frequencies $`\omega _0,\omega _1,\mathrm{},\omega _{N^{}1}`$ are the different real numbers from $`[0,1)`$. Denote by $`E_k`$ the space spanned by all eigenvectors corresponding to $`\omega _k`$. An arbitrary vector with the length 1 from $`E_k`$ will be denoted by $`\mathrm{\Phi }_k`$. Thus every state $`\xi `$ has the form $`\xi =\underset{k=0}{\overset{N^{}1}{}}x_k\mathrm{\Phi }_k`$.

Let $`\mathrm{\Omega }=\{\stackrel{~}{\omega }_{k,i}\}`$ be some set of integers from $`\{0,1,\mathrm{},L1\}`$, $`0i1,0kN^{}1`$; $`\epsilon ,\delta >0`$. Denote $`L_\epsilon ^k(\mathrm{\Omega })=\{i:|(0.\stackrel{~}{\omega }_{k,i})_p\omega _k|\epsilon `$ or
$`|(0.\stackrel{~}{\omega }_{k,i})_p\omega _k1|\epsilon \}`$.

Definition 1 A transformation $`W`$ of the form

$$W:|\xi ,0^{m+4}\underset{k=0}{\overset{N^{}1}{}}\underset{i=0}{\overset{L1}{}}\lambda _{i,k}|\mathrm{\Phi }_k,\stackrel{~}{\omega }_{k,i}$$

is called a transformation of $`W_{\delta ,\epsilon }`$ type if for all $`k`$ and $`\xi `$ $`\underset{iL_\epsilon ^k(\mathrm{\Omega })}{}|\lambda _{i,k}|^2|x_k|^2(12\delta )`$.

Thus, $`\delta `$ is an error probability of getting right frequencies $`\omega _k`$ by observation of the second register, and $`\epsilon `$ is a precision of frequencies approximations.

Definition 2 A unitary operator $`R`$ is called revealing frequencies of $`U`$ if $`R`$ belongs to the type $`W_{\frac{1}{K},\frac{K}{L}}`$ for any $`K\{1,2,\mathrm{},L\}`$.333in what follows we shall use this notion only with $`K=16`$.

The key here is the quantum version of Fourier transform defined by

$$\mathrm{QFT}_L:|s\frac{1}{\sqrt{L}}\underset{l=0}{\overset{L1}{}}e^{\frac{2\pi isl}{L}}|l$$

We need also the following generalization $`U_{seq}`$ of operator $`U_{cond}`$:

$$\mathrm{U}_{seq}^L|x,a=|\mathrm{U}^ax,a.$$

This is the result of $`a`$ sequential applications of $`U`$ to the main register. To implement this operator by means of $`U_{cond}`$ fulfill the following cycle. For integer counter $`j`$ altering from 1 to the maximal value $`L1`$ of $`a`$ apply $`U`$ iff $`ja`$. Then one cycle consists of $`U_{cond}`$ with a properly prepared controller and the resulting operator will be $`U_{seq}^L`$.

Define an operator revealing frequencies by

$$\mathrm{Rev}=\mathrm{QFT}_L\mathrm{U}_{seq}^L\mathrm{QFT}_L,$$

where quantum Fourier transforms are applied to the second register 444the first $`\mathrm{QFT}`$ can be replaced by Walsh-Hadamard transform as in \[AL\] because on zero ancilla it is equivalent. In the work \[Oz\] it was proved that $`\mathrm{Rev}`$ is a transformation revealing frequencies. Now we need more. For the redistribution of amplitudes $`x_k`$ we shall need also a transformation $`\mathrm{Rest}`$ cleaning the second register. An ideal candidate for this role would be $`\mathrm{Rev}^1`$ but a problem is that it requires an application of $`U^1`$ that is physically unrealizable given only device fulfilling $`U`$ excluding evident cases where say $`U=U^1`$. We can use this easiest definition of $`\mathrm{Rest}`$ only in case when we are given a circuit implementing $`U`$ (say, gate array) because then $`U^1`$ is accessible for us as well as $`U`$. But if $`C`$ is given only as a black box then the restoring operator should be defined separately.

We shall find an operator restoring ancilla in the form

$$\mathrm{Rest}=\mathrm{Rev}D$$

where $`D`$ is some operator of turning.

Let we are given some integers $`\stackrel{~}{\omega }_k^L`$ of the form $`\frac{q}{L}`$, $`q`$ \- integer, $`\stackrel{~}{\omega }_k^L\omega _k`$. Then we could define an operator of turning $`D`$ by $`D|\mathrm{\Phi }_k,l=e^{2\pi i(L1)\delta _{k,l}}|\mathrm{\Phi }_k,l`$ where $`\delta _{k,l}=\stackrel{~}{\omega }_k^L(0.l)_m`$. It was proved in \[Oz\] that $`(\mathrm{RestRev}|\chi ,\overline{0}|\chi ,\overline{0}<7M/L`$ which means that so defined restoring operator really restores zeroes in the second register after action of $`\mathrm{Rev}`$ provided $`L`$ is large enough. To create these good approximations we apply a bit more general construction. Put

$$D=\mathrm{Enh}\stackrel{~}{D}\mathrm{Enh}$$

where an operator $`\mathrm{Enh}`$ calculates an integer function $`h(l)`$ giving a good approximation $`(0.h(l))_p`$ of frequencies in within $`1/L`$ given their rough approximation $`(0.l)_m`$ in within $`1/M`$ and places them into ancilla, $`\stackrel{~}{D}`$ turns each eigenvector on appropriate angle:
$`\stackrel{~}{D}|\mathrm{\Phi }_k=e^{2\pi i(M1)((0.h(l))_p(0.l)_p)}|\mathrm{\Phi }_k`$ and the last application of $`\mathrm{Enh}`$ cleans ancilla. An operator $`\mathrm{Enh}`$ is accessible given good approximations of eigenvalues. Thus our operator $`\mathrm{Rest}`$ restores zeroes in ancilla in within $`1/L`$.

We can reach an accuracy $`1/L`$ of all operators of type $`\mathrm{Rest}`$ that will be less than $`1/t`$ where $`t`$ is the number of all steps in computation and this accuracy can be guaranteed with $`\mathrm{log}L=p`$ registers. Emphasize that this difficulty with eigenvalue precision arises only when $`U^1`$ is inaccessible - in the problem of recognition of electronic circuits in the section 3.4 where we must choose $`LM`$.

Operators $`\mathrm{Rev}`$ and $`\mathrm{Rest}`$ can be built in the form of quantum gate array using universal quantum Klini function $`\mathrm{App}`$ where a code $`[C]`$ of circuit generating $`U`$ is a part of input. We shall write the operator $`U`$ corresponding to these two operators as its upper index.

## 3 Problems of recognition

### 3.1 Getting eigenvectors and recognition of eigenvalues

Our assumption about sparse spectrum now is stated as $`L=16M=const`$. In view of that $`\mathrm{Rev}`$ reveals frequencies it belongs to the type $`W_{\frac{1}{16},\frac{1}{M}}`$. By the definition of $`W_{\delta ,\epsilon }`$ it means that $`\mathrm{Rev}`$ gives a state $`\underset{k=0}{\overset{N^{}1}{}}\underset{i=0}{\overset{M1}{}}\lambda _{i,k}|\mathrm{\Phi }_k,\stackrel{~}{\omega }_{k,i}`$ where the seven eighth of probability is concentrated on such pairs $`i,k`$ that $`(0.\omega _{i,k})_m`$ is closed to $`\omega _k`$. This means that we can get eigenvalues with high probability observing the second register whereas the first register will contain the corresponding eigenvector. This way of getting eigenvectors was proposed in the papers \[AL, TM\]. The first disadvantage of it is irreversibility. Observing a state we lose full information about it and cannot use this state again that is very important for building of nontrivial quantum algorithms. The second disadvantage is that this way gives a random eigenvector when it is typically required to obtain the eigenvector corresponding to a given frequency.

Let we are given a good approximation $`\stackrel{~}{\omega }^L`$ of some frequency $`\omega `$ written as a string of $`p`$ its sequential binary figures and let $`_\omega =\{\mathrm{\Phi }_1^\omega ,\mathrm{}\mathrm{\Phi }_l^\omega \}`$ be a basis of the subspace $`E_\omega `$ of eigenvectors corresponding to all frequencies $`\omega ^{}\omega `$. We shall build an operator $`\mathrm{State}_\omega `$ which concentrates the bulk of amplitude on some superposition of the corresponding eigenvectors: $`\underset{j=1}{\overset{l}{}}\lambda _j\mathrm{\Phi }_j^\omega E_\omega `$. For this aim we are going to apply GSA. Let $`|\overline{a}`$ be some randomly chosen vector from the main space: $`|\overline{a}=\underset{j=1}{\overset{l}{}}\mu _j\mathrm{\Phi }_j^\omega +\underset{s}{}\nu _s\mathrm{\Phi }_s`$ where all eigenvectors from the second sum correspond to frequencies $`\omega ^{}\omega `$. Here our target state will be the following vector $`E_\omega (\overline{a})=\underset{j=1}{\overset{l}{}}\lambda _j\mathrm{\Phi }_j^\omega `$ where $`\lambda _j=\frac{\mu _j}{\sqrt{\underset{j=1}{\overset{l}{}}|\mu _j|^2}}`$, that is a vector of the length 1 directed along the projection of $`\overline{a}`$ to subspace $`E_\omega `$.

Let $`A`$ be some set of vectors. We denote by $`I_A`$ an operator changing the sign of all vectors from $`A`$ and remaining unchanged all vectors orthogonal to $`A`$. We need to obtain the operator $`I_{E_\omega }`$ constrained to the two dimensional subspace $`S(\overline{a},\omega )`$ spanned by vectors $`|\overline{a}`$ and $`E_\omega (\overline{a})`$.

Let $`\mathrm{Rev}_j,\mathrm{Rest}_j`$ be $`j`$-th copies of the operators $`\mathrm{Rev},\mathrm{Rest}`$ acting on the corresponding places of $`j`$-th register. Denote by $`l_j`$ a string contained in the place for frequency of $`j`$-th register. Put

$$\stackrel{~}{I}_{E_\omega }=\underset{j}{\overset{v}{}}\mathrm{Rest}_j\mathrm{Sign}_\omega \underset{j}{\overset{v}{}}\mathrm{Rev}_j$$

then $`\mathrm{Sign}_\omega `$ changes a sign if and only if for at least $`1/2`$ of all $`j`$ $`|(0.l_j)_p(0.\stackrel{~}{\omega }^L)_p|1/L`$555We could choose any fixed $`\rho :\frac{1}{8}<\rho <\frac{7}{8}`$ instead of $`1/2`$. Really, so defined $`\stackrel{~}{I}_{E_\omega }`$ will change the sign of all $`\overline{a}E_\omega `$. If $`\overline{a}E_\omega `$ then the probability to obtain $`\omega `$ observing the frequency from $`\mathrm{Rev}`$ is less than $`\frac{1}{8}`$. Applying reasoning from the end of section 2.1 we conclude that the actions of $`I_{E_\omega }`$ and $`\stackrel{~}{I}_{E_\omega }`$ restricted on $`S(a,\omega )`$ will differ on less than $`\frac{1}{2^{O(v)}}`$ and thus this different can be done very small by only linear growth of memory. We thus will omit $`\stackrel{~}{}`$ in our notations.

We define

$$\mathrm{St}=\mathrm{GenArg}^1\mathrm{GenTimeArg}^1(I_{\overline{a}}I_{E_\omega })^t\mathrm{GenTimeArg}\mathrm{GenArg}$$

where $`\mathrm{GenArg}`$ and $`\mathrm{GenTimeArg}`$ generate a pair $`\overline{a},[C]`$ and a time instant $`t`$ correspondingly where $`C`$ is a gate array implementing $`I_{\overline{a}}`$. Here the actions of $`I_{\overline{a}}`$ are implemented by the universal function of application $`\mathrm{App}`$. Then the result $`\xi =\mathrm{St}|\overline{0}`$ of its action on $`\overline{0}`$ will be closed to $`E_\omega (\overline{a})`$. Really, $`|E_\omega (\overline{a})|\xi |=|\mathrm{sin}(2t\mathrm{arcsin}\overline{a}|E_\omega (\overline{a}))|`$ (look at \[BBHT\]). An average value of $`|\overline{a}|E_\omega (\overline{a})|`$ with the uniformly distributed probability of choice $`\overline{a}`$ and $`t`$ over all space and time frame $`[0,B]`$ correspondingly will be of order $`1/\sqrt{N}`$. Thus if $`t`$ is chosen randomly from the uniform distribution over $`1,2,\mathrm{},B`$ then $`|E_\omega (\overline{a})|\xi |^2`$ will have average value not less than $`1/4`$. Of course it would be much more convenient to obtain $`E_\omega (\overline{a})`$ with the error probability converging to zero that is possible by the method described in section 2.1. Namely, arrange $`h`$ equal registers for the states $`\chi _k,k=1,2,\mathrm{},h`$ in the main space, the corresponding $`h`$ registers for frequencies and associate the variable $`t_k`$ with each $`k`$-th register. Let $`\mathrm{St}_k`$ be a pattern of $`\mathrm{St}`$ operator acting on $`k`$-th register. Remind that operators $`\mathrm{GenArg}_k`$ and $`\mathrm{GenTimeArg}_k`$ generate independent distributions for different $`k=1,2,\mathrm{},h`$. Now we define

$$\mathrm{State}^\omega =\mathrm{St}_1\mathrm{St}_2\mathrm{}\mathrm{St}_h.$$
(2)
So defined operator being applied to zero initial state gives a state $`\chi _1\chi _2\mathrm{}\chi _h`$ where an average value of $`|E_\omega (\chi _k)|\chi _k|^2`$ will be closed to some number not less than $`1/4`$ with the vanishing probability of error. By the way it means that if we then apply to this state the corresponding operators revealing frequencies: $`\mathrm{Rev}_1\mathrm{Rev}_2\mathrm{}\mathrm{Rev}_h`$ then in the resulting state $`\chi `$ the majority of amplitude will be concentrated on such basic states for which at least $`\frac{5}{32}`$ of all registers for frequencies contain numbers $`l`$ for which $`|(0.l)_m(0.\stackrel{~}{\omega }^L)_p|<1/L`$666Note that in this criterion $`\frac{5}{32}`$ could be replaced by any $`\rho :`$ $`0<\rho <\frac{1}{4}\frac{7}{8}=\frac{7}{32}`$.. On the other hand, if $`\omega `$ is not a frequency at all then the probability to obtain such basic state will be vanishing in view of independence of distributions generated by $`\mathrm{GenTimeArg}_k`$ and $`\mathrm{GenArg}_k`$ for the different $`k`$.

The time complexity of this algorithm is of order $`M\sqrt{N}n^2`$. The last multiplier arises due to the copying of registers. Thus we have a solution of the first problem of recognition of eigenvalues.

### 3.2 Finding thermodynamic functions

Let we are given a structure of molecule of a gas. The problem is to find its thermodynamic function (1). In view of that a summand in this sum quickly converges to zero it is sufficient to find few first summands. Thus it is sufficient to be able to find degree of degeneracy of the subspace corresponding to frequencies $`\omega ^{}\omega `$ for any $`\omega =l/M`$. Let $`E_0<E_1<\mathrm{}<E_s`$ be energy levels of a molecule or eigenvalues of its Hamiltonian $`H`$. Then the operator of evolution in time frame $`t`$ will be $`U=e^{\frac{iH}{h}t}`$. An addition of a diagonal matrix $`rI`$ with constant $`r`$ to a Hamiltonian does not change the physical picture. Then choosing $`r=E_s,t=\frac{h}{2\pi E_s}`$ we obtain a unitary operator $`U`$ which frequencies belong to the segment $`[0,1)`$ and thus we reduce the problem to the case we have already dealt with.

Assume that $`M`$ is fixed and we must examine only few frequencies closed to $`0`$. At first we can recognize all numbers of the form $`l/M`$ that are frequencies in within $`1/L`$. Let $`\omega `$ be such number. Show how we can find the degree of degeneracy $`d`$ of the corresponding subspace. This is the dimension of subspace $`E_\omega `$ spanned by eigenvectors corresponding to frequencies $`\omega ^{}\omega `$. Our plan is the following. Build an operator $`I_{E_\omega }`$ of reflection along this subspace. Then using a counting procedure built in the paper \[BBHT\] we evaluate the time required for turning of arbitrary initial vector till this subspace. This time will be about $`\sqrt{\frac{N}{d}}`$ and thus we find $`d`$. Fix some $`ϵ>0`$ and show how to obtain the value of $`d`$ in within $`ϵd`$.

Let operators $`\mathrm{GenTimeArg}_j^a`$ generate time instants $`t_j`$ from independent uniform distributions on the segment $`[0,[a]]`$, where $`a`$ is nonnegative number. For $`a`$ from 1 to $`\sqrt{N}`$ fulfil the following loop of three steps:

1. Apply an operator

$$\underset{j}{}\left[\underset{k}{}\mathrm{Rev}_{j,k}\right](I_{\overline{a}}I_{E_\omega })^{t_j}\mathrm{GenTimeArg}_j^a\mathrm{GenArg}_j$$
2. Find the fidelity of result that is the number of all $`j`$ for which at least $`\frac{7}{8}ϵ`$ of all $`k`$ are such that $`\omega _{j,k}\omega `$. If the fidelity of this step is larger than on the previous, then proceed the loop, if not then stop.
3. Replace $`a`$ by $`4a/3`$.

If by the point 2 we finish computation then the current value $`a`$ is taken as the rough approximation of $`d`$ from above. We have $`3a/4da`$. To find $`d`$ more exactly divide the segment $`[3a/4,a]`$ to $`[1/ϵ]`$ equal parts by points $`a_0<a_1<\mathrm{}<a_l`$ and repeat the procedure from above sequentially for all $`a_i`$. Thus we shall determine $`d`$ in within $`g(ϵ)d`$ where function $`g`$ quickly converges to zero with $`ϵ`$. Thus our algorithm finds $`d`$ and thermodynamic functions with arbitrary relative error in the time $`O(\sqrt{N})M`$ where the constant depends on admissible error. The more refined algorithm can be obtained if we apply the method of counting from the work \[BHT\]. In that work quantum Fourier transform is used analogously to Abrams and Lloyd operator $`\mathrm{Rev}`$ only in order to find a time period of function $`G|\xi ,t=|G^t\xi ,t`$ that is about $`\sqrt{N/d}`$. Their method gives the accuracy of order $`\sqrt{d}`$ which means that the relative error converges to zero if $`d\mathrm{}`$.

### 3.3 Recognition of molecular structures

Now take up a problem of recognition of molecular structures. Here we are given a spectrum of molecule and a problem is to recognize its construction. Note that now we have not access to a device but it is sufficient to find an arbitrary device generating this spectrum. Clarify the formulation assuming the following form of determining spectrum. Let we are given a set $`\overline{w}=\{w_1,\mathrm{},w_Q\}`$ of numbers from $`[0,1)`$ of the form $`w_i=\frac{l_i}{M}`$ each where $`l_i\{0,1,\mathrm{},M1\}`$. Denote by $`F`$ a subspace spanned by vectors of the form $`|l_i,i=1,\mathrm{}Q`$. A spectrum $`S`$ is determined by this set $`\overline{w}`$ if

* for each $`\omega S`$ there exists its good approximation $`w_i\overline{w}`$: $`|w_i\omega |\frac{1}{L}`$ and
* each $`w_i\overline{w}`$ is a good approximation of some $`\omega S`$.

We would obtain a little different formulations of the problem if we want to find a circuit whose spectrum only contains one given set of frequencies and/or does not contain some other set, or permit some more general form of sparse set for $`\overline{w}`$ instead of $`\frac{l_i}{M}`$. These versions of the problem at hand have similar solutions.

As above we shall find a recognizing algorithm in GSA form

$$(I_{\stackrel{~}{0}}I_{cir,\overline{w}})^t$$
(3)
where $`\stackrel{~}{0}`$ is arbitrarily chosen vector from the space spanned by codes of circuits, $`t=O(\sqrt{T})`$ where $`T`$ is a number of all possible circuits, and $`I_{cir,\overline{w}}`$ is reflection along all such codes $`[C]`$ that $`\mathrm{Spectr}(U_C)`$ is determined by $`\overline{w}`$. Now it is sufficient to build $`I_{cir,\overline{w}}`$.

Choose $`B_f=O(\sqrt{Q})`$ so that a randomly chosen vector $`wF`$ satisfies $`|w|w_1|>1/B_f`$ with probability $`0.99`$. Let $`\mathrm{GenFreq}_j`$, $`\mathrm{GenTimeFreq}_j`$ be operators generating correspondingly: a linear combination of frequencies $`\stackrel{~}{\omega }_jF`$ and time instant $`t_{freq,j}B_f`$ \- all these objects from the corresponding uniform distributions over all possible values, and a code of gate array generating inversion along the corresponding state $`\stackrel{~}{\omega }_j`$. These operators will generate the objects in the corresponding ancillary registers. Denote by $`\omega _j`$ a frequency contained in the $`j`$-th register (that is initially $`\stackrel{~}{\omega }_j`$).

Assume that a code of circuit generating $`U`$ is fixed. Define an operator $`I_{cir,\overline{w}}`$ by

$$\begin{array}{c}I_{cir,\overline{w}}=\underset{j}{}\left[\mathrm{GenFreq}_j^1\mathrm{GenTimeFreq}_j^1(I_{BadFreq,\overline{w},j}I_{\stackrel{~}{\omega }_j})^{t_{freq,j}}\right]\mathrm{SignGoodFreq}\hfill \\ \underset{j}{}\left[(I_{\stackrel{~}{\omega }_j}I_{BadFreq,\overline{w},j})^{t_{freq,j}}\mathrm{GenFreq}_j\mathrm{GenTimeFreq}_j\right].\hfill \end{array}$$

where $`I_{BadFreq,\overline{\omega },j}`$ will invert a sign of states with ”bad frequencies” in $`j`$-th register that are such values of $`\omega _j`$ of the form $`\frac{l}{M}`$, $`l\{0,1,\mathrm{},M1\}`$ which either belong to $`\overline{w}`$ and are not a good approximation of frequencies $`\omega \mathrm{Spectr}(V)`$ or do not belong to $`\overline{w}`$ but have a closed $`\omega \mathrm{Spectr}(V)`$: $`|\omega _j\omega |\frac{1}{L}`$; for all other frequencies this operator acts like identity. Application of the sequence preceding $`\mathrm{SignGoodFreq}`$ concentrates amplitude on ”bad frequencies”. Note that $`I_{\stackrel{~}{\omega }_j}`$ can be implemented by a given code by means of quantum Klini operator $`\mathrm{App}`$. The following application of $`\mathrm{SignGoodFreq}`$ inverts a sign of state subject to are there bad frequencies or not. Namely, for codes $`[C]`$ without bad frequencies $`\mathrm{SignGoodFreq}`$ changes the sign, for codes $`[C]`$ with bad frequencies it makes nothing. The following operators clean all ancilla. Thus so defined $`I_{cir,\overline{w}}`$ will invert a sign of exactly those codes $`C`$ for which $`\mathrm{Spectr}(U_C)`$ is determined by $`\overline{w}`$. We need to define two types of operators: $`\mathrm{SignGoodFreq}`$ and $`I_{BadFreq,\overline{w},j}`$.

Associate with each $`\omega _j`$ contained in $`j`$-th register the family of registers enumerated by two indices $`j,k`$ and containing frequencies $`\omega _{j,k}`$.

Definition 3. Call a family of all $`\omega _{j,k}`$ good if for at least $`1/5`$ from all $`j`$ the following property takes place: for at least $`1/10`$ of all $`k`$ $`\omega _{j,k}\omega _j\overline{w}`$.

Registers enumerated by different $`k`$ for a fixed $`j`$ are designed for the application of $`j`$-th copy of operator $`\mathrm{State}^\omega `$ defined in the previous section. Here it has the form $`\mathrm{State}^{\omega _j}`$. Each $`k`$ corresponds to the operator $`\mathrm{St}_k`$ from the definition (2) so that each $`\omega _{j,k}`$ will be a frequency obtained from the result of $`\mathrm{St}_k`$ action.

At first build an operator $`I_{BadFreq,\overline{w},j}`$. Put

$$I_{BadFreq,\overline{w},j}=\underset{j,k}{}\left[(\mathrm{State}^{\omega _j})^1\mathrm{Rest}_{j,k}\right]\mathrm{Sign}^{}\underset{j,k}{}\left[\mathrm{Rev}_{j,k}\mathrm{State}^{\omega _j}\right]$$

where an operator $`\mathrm{Sign}^{}`$ will change a sign of only states with bad families of frequencies.

If a frequency $`\omega _j`$ is bad then in the previous section it was shown that only for vanishing part of all $`k`$ we can have $`\omega _{j,k}\omega _j\overline{w}`$ and before $`\mathrm{Sign}^{}`$ almost all probability will be concentrated on bad families $`\omega _{j,k}`$, hence $`I_{BadFreq,\overline{w},j}`$ changes the sign.

If $`\omega _j`$ is good then it belongs to $`\overline{w}`$ and has a closed $`\omega ^{}S`$. By the previous section for about $`\frac{7}{8}\frac{1}{4}=\frac{7}{32}>\frac{1}{5}`$ of all $`k`$ will be $`\omega _{j,k}\omega \overline{w}`$ and before $`\mathrm{Sign}^{}`$ almost all probability will be concentrated on good families, hence the sign will not be changed.

Thus $`I_{BadFreq,\overline{w},j}`$ is defined correctly.

Put

$$\mathrm{SignGoodFreq}=\underset{j,k}{}\left[(\mathrm{State}^{\omega _j})^1\mathrm{Rest}_{j,k}\right]\mathrm{Sign}\underset{j,k}{}\left[\mathrm{Rev}_{j,k}\mathrm{State}^{\omega _j}\right]$$

where an operator $`\mathrm{Sign}`$ changes a sign only for states with good families of frequencies. If a frequency $`\omega _j`$ is not bad then for about $`\frac{1}{4}\frac{7}{8}=\frac{7}{32}`$ of all $`k`$ will be $`\omega _{j,k}\omega _j\overline{w}`$. If a frequency $`\omega _j`$ is bad then we can obtain $`\omega _{j,k}\omega _j\overline{w}`$ only for the vanishing part of $`k`$ as it was shown in the previous section. Thus $`\mathrm{SignGoodFreq}`$ acts how it is needed777Again we could take arbitrary $`\rho _1:0<\rho _1<1`$ instead of $`\frac{1}{10}`$ and $`\rho _2:0<\rho _2<\frac{7}{32}`$ instead of $`1/5`$ in the definition of a good family..

Now calculate the complexity of our algorithm recognizing molecular circuit. The first multiplier $`\sqrt{T}`$ issues immediately from (3). The following multiplier as $`\sqrt{Q}`$ issues from the immediate definition of $`I_{cir,\overline{w}}`$. At last the definition of $`I_{BadFreq,\overline{w}}`$ brings the multiplier $`M\sqrt{N}`$. The resulting complexity will be of order $`M\sqrt{TNQ}n^2`$.

### 3.4 Distinguishing of eigenvectors of two operators with the same eigenvalue

Now we are going to take up the most difficult of our problems - a problem of recognition of electronic devices. The difficulty is that here we need not to find a circuit with given spectrum but to simulate an action of given circuit. Remind that now we assume that frequencies can be determined in within $`1/L`$ given their approximation in within $`1/M`$ where $`LM`$.

As a first step we consider the following question. Given two operators $`U`$ and $`V`$ having the same eigenvalue $`\omega `$ how to find a difference between the corresponding eigenvectors? Let $`L_\omega ^U,L_\omega ^V`$ be the subspaces spanned by eigenvectors of $`U`$ and $`V`$ corresponding to all frequencies $`\omega ^{}\omega `$. (A particular case is when $`\omega `$ is a frequency of $`U`$ but not of $`V`$. Here $`L_\omega ^V=\mathrm{}`$ and our algorithm will work in this situation.) We shall omit the index $`\omega `$ in the notations. For $`uL^U,u=1`$ put

$$\mu _u=\mathrm{min}\{\sqrt{1|u|v|^2}|vL^V,v=1\}.$$

that is the sine of angle between a vector $`u`$ and the subspace $`L^V`$ or a distance between $`u`$ and this subspace, and analogously define $`\mu _v`$ for $`vL^V,v=1`$.

Put

$$\mu _U=\underset{uU}{\mathrm{max}}\mu _u,\mu _V=\underset{vV}{\mathrm{max}}\mu _v.$$

Then say $`\mu _U=0`$ means that $`UV`$. If the dimension of spaces $`L^U,L^V`$ are equal then $`\mu _U=\mu _V`$, if they are not equal, say $`dimL^U>dimL^V`$ then $`\mu _U=1`$.

Let $`d=d(N)`$ be some function taking values from $`(0,1]`$.

Call these subspaces $`d`$\- distinguishable if some of $`\mu _U,\mu _V`$ is not less than $`d`$, or some of the subspaces is empty and another is nonempty.

We shall build a procedure that determines are these subspaces the same or not provided they can be either $`d`$\- distinguishable or coincident. The less the function $`d(N)`$ is the more accurate our recognition will be. Let $`L^UL^V=L_0`$. Then $`L^U=L_0L_U^{}`$ and $`L^V=L_0L_V^{}`$. Note that if $`L_U^{}\mathrm{}`$ then for all vectors from $`L_U^{}`$ of the length 1 their distances from $`L^V`$ are exactly $`\mu _U`$ and the same thing takes place with $`L^V`$ if $`L_V^{}`$ is not empty. Let $`L^{}`$ be linear subspace spanned by vectors from $`L_V^{}L_U^{}`$. Denote by $`\mathrm{Proj}_AB`$ a projection of subspace $`B`$ to subspace $`A`$. If $`dimL^U>dimL^V`$ then we have the following expansion to the sum of orthogonal subspaces: $`L^U=L_U^{\prime \prime }\mathrm{Proj}_{L^U}L^V`$, where $`L_U^{\prime \prime }`$ is a subspace in $`L^U`$ consisting of vectors orthogonal to $`L^V`$. Let $`L_V^{\prime \prime }`$ be defined symmetrically.

Then either

* $`L^U=L^V`$ or
* $`dimL^U=dimL^V`$ and $`L^{}\mathrm{}`$, or
* $`dimL^U>dimL^V`$ and $`L_U^{\prime \prime }\mathrm{}`$, or
* $`dimL^U<dimL^V`$ and $`L_V^{\prime \prime }\mathrm{}`$.

We define the main operator determining the equality of $`L^U`$ and $`L^V`$ by

$$\begin{array}{c}\mathrm{Difference}=\mathrm{Differ}^1\mathrm{SignDif}\mathrm{Differ},\hfill \\ \mathrm{Differ}=\mathrm{Dif}_{samedim}\mathrm{Dif}_{L^U>L^V}\mathrm{Dif}_{L^U<L^V}\mathrm{Dif}_{L^U>L^V}^{ort}\mathrm{Dif}_{L^U<L^V}^{ort}\hfill \end{array}$$
(4)
where $`\mathrm{SignDif}`$ changes a sign of main ancilla $`\alpha _{dif}`$ iff at least one ancilla from the list $`\overline{\alpha }=\{\alpha _{samedim},\alpha _{L^U>L^V},\alpha _{L^U<L^V},\alpha _{L^U>L^V}^{ort},\alpha _{L^U<L^V}^{ort}\}`$ contains 1, and each operator of the sort $`\mathrm{Dif}`$ changes the corresponding ancilla from $`\overline{\alpha }`$ in cases

* $`dimL^U=dimL^V`$ and $`L^UL^V`$,
* $`dimL^U>dimL^V`$ and $`\mu _V<\sqrt{2/3}`$,
* $`dimL^U<dimL^V`$ and $`\mu _U<\sqrt{2/3}`$,
* $`dimL^U>dimL^V`$ and $`\mu _V>\sqrt{1/3}`$, or $`L^V=\mathrm{}`$,
* $`dimL^U<dimL^V`$ and $`\mu _U>\sqrt{1/3}`$, or $`L^U=\mathrm{}`$

correspondingly and all of them do nothing if $`L^U=L^V`$. In view of symmetry it is sufficient to define $`\mathrm{Dif}`$ operators in the first, second and fourth cases. Note that the first case $`dimL^U=dimL^V`$ is the only non-degenerate case and the definition of $`\mathrm{Dif}`$ here will be the most difficult.

Definition of  $`\mathrm{Dif}_{samedim}`$.

Suppose that $`dimL^U=dimL^V`$. Our first aim now is to build an operator $`\mathrm{Inv}`$ which acts as identity if $`L^U`$ and $`L^V`$ are coincident and acts like $`I_L^{}`$ if they are $`d`$\- distinguishable. Arrange the first two ancillary qubits $`\alpha _U,\alpha _V`$ which will signal that a state at hand has a projection at least of the length $`1/3`$ to $`L^U`$ or, correspondingly to $`L^V`$. Consider the following operator

$$\mathrm{Check}=\underset{s}{}\mathrm{Rest}_s^V\mathrm{Anc}_V\underset{s}{}\mathrm{Rev}_s^V\underset{s}{}\mathrm{Rest}_s^U\mathrm{Anc}_U\underset{s}{}\mathrm{Rev}_s^U$$

where $`\mathrm{Anc}`$ inverts the corresponding ancilla if and only if at least nine tenth of copies for the respective frequencies are equal to $`\omega `$ in within $`1/M`$. It coincides with the inverse operator $`\mathrm{Check}^1`$.

Let $`t`$ be some random integer from the segment $`[0,\left[\frac{2}{d}\right]]`$. We define the following operator of Grover’s type:

$$\mathrm{Turn}_t=(I_{L^U}I_{L^V})^t$$
(5)
Call two subspaces $`L^U`$ and $`L^V`$ almost orthogonal iff for some $`\mu \{\mu _U,\mu _V\}`$ $`\sqrt{1\mu ^2}1/30`$. If $`L^U`$ and $`L^V`$ are not almost orthogonal then given some $`aL_U^{}`$ ($`aL_V^{}`$) an average distance between $`\mathrm{Turn}_t|a`$ and $`L_U`$ ($`L_V`$) will be at least 1/2 if $`L^U`$ and $`L^V`$ are $`d`$\- distinguishable and zero if these subspaces are coincident. To tell apart close location and almost orthogonality build two operators: $`\mathrm{Dist}_{ort}`$ and $`\mathrm{Dist}_{closed}`$.

At first suppose that $`L^U`$ and $`L^V`$ are almost orthogonal. Then $`\alpha _U=1`$ means that $`\alpha _V=0`$. Introduce a notation

$$L(\alpha _U,\alpha _V)=\{\begin{array}{cc}L^V,& \text{if}\alpha _U=1,\\ L^U,& \text{if}\alpha _V=1.\end{array}$$

Let $`\overline{a}`$ be a vector at hand from the space of inputs. Note that if $`L^UL^V`$ then for each $`\overline{a}L^{}`$ we shall have $`\alpha _U=\alpha _V`$ because such $`\overline{a}`$ belongs to the subspace spanned by $`L_0`$ and orthogonal subspace to $`L^UL^V`$. The first operator $`\mathrm{Dist}_{ort}`$ will do nothing if $`\alpha _U=\alpha _V`$ and will change a sign and a special ancilla $`\alpha _{ort}`$ if a projection of $`\overline{a}`$ to $`L(\alpha _U,\alpha _V)`$ is less than $`1/30`$.

The second operator $`\mathrm{Dist}_{closed}`$ will act like identity if $`\alpha _U=\alpha _V`$ and will change a sign in case when the following conditions are satisfied simultaneously: $`\overline{a}L^{}`$, $`L^U`$ and $`L^V`$ are distinguishable, $`\alpha _{ort}=0`$.

Put

$$\mathrm{Dist}_{ort}=\underset{j}{}\mathrm{Res}_j\mathrm{Si}_\omega \underset{j}{}\mathrm{Re}_j$$

where $`\mathrm{Re}`$ ($`\mathrm{Res}`$) denotes $`\mathrm{Rev}^V`$ ($`\mathrm{Rest}^V`$) if $`\alpha _U=1,\alpha _V=0`$, $`\mathrm{Rev}^U`$ ($`\mathrm{Rest}^U`$) if $`\alpha _V=1,\alpha _U=0`$, and identity if $`\alpha _U=\alpha _V`$; $`\mathrm{Si}_\omega `$ changes a sign inverting simultaneously $`\alpha _{ort}`$ iff at least a half of frequencies $`\omega _j`$ are such that $`|\omega _j\omega |>1/M`$ and $`\alpha _U\alpha _V`$. If we want to clean the second ancilla after the action of $`\mathrm{Dist}_{ort}`$ and remain change in sign then we can use an operator $`\mathrm{Dist}_{ort}^{}=_j\mathrm{Res}_jS_\omega _j\mathrm{Re}_j`$ where $`S`$ acts like $`\mathrm{Si}`$ only without changing a sign.

The second operator will be defined by the following equations

$$\begin{array}{c}\mathrm{Dist}_{closed}=D_1^1\mathrm{}D_n^1S^{}D_nD_{n1}\mathrm{}D_1,\hfill \\ D_j=(\mathrm{GenTimeArg}_j)^1(\mathrm{Turn}_{t_j}^j)^1\left[\underset{k}{}\mathrm{Rest}_{j,k}^U\right]\mathrm{Sig}_\omega ^j\left[\underset{k}{}\mathrm{Rev}_{j,k}^U\right]\mathrm{Turn}_{t_j}^j\mathrm{GenTimeArg}_j\hfill \\ j=1,2,\mathrm{},n,\hfill \end{array}$$

where operator $`\mathrm{Sig}_\omega ^j`$ changes the corresponding ancilla $`\beta _j`$ only in one of the two cases:

* $`\alpha _U=1`$ and at least a half of $`\omega _{j,k}`$ are such that $`|\omega _{j,k}\omega |1/M`$, or
* $`\alpha _U=0,\alpha _V=1`$ and at least a half of $`\omega _{j,k}`$ are such that $`|\omega _{j,k}\omega |<1/M`$.

An operator $`S^{}`$ changes a sign iff some of $`\alpha _U,\alpha _V`$ is nonzero and at least $`1/20`$ of all $`\beta _j`$ contain 1.

Consider the action of $`\mathrm{Dist}_{closed}`$ following to $`\mathrm{Check}`$ on an input vector $`\overline{a}`$. Let at first $`L^UL^V`$ which means that they are distinguishable.

If $`\overline{a}L^U,L^V`$ then $`\alpha _U=\alpha _V=0`$ and $`\mathrm{Dist}_{closed}`$ makes nothing.

If $`\overline{a}L_0`$ then $`\alpha _U=\alpha _V=1`$ and all $`\mathrm{Sig}_\omega ^j`$ makes nothing because for almost all $`j`$ about $`3/4`$ of $`\omega _{j,k}`$ are closed to $`\omega `$: $`|\omega _{j,k}\omega |1/M`$, hence $`S^{}`$ and $`\mathrm{Dist}_{closed}`$ do nothing.

Let $`\overline{a}L^{}`$. Prove that $`\mathrm{Dist}_{closed}`$ changes a sign. Expand $`L^{}`$ to the sum of orthogonal subspaces: $`L^{}=L_U^{}L_{U}^{}{}_{}{}^{ort}`$. Denote the result of action of $`\mathrm{Turn}_{t_j}^j`$ on $`\overline{a}`$ by $`\overline{a}_j`$.

If $`\alpha L_U^{}`$ then $`\alpha _U=1`$, and for more than $`1/10`$ of all $`\overline{a}_j`$ revealed frequencies are not closed to $`\omega `$ with probability about $`\frac{3}{4}\frac{9}{10}`$, hence a sign will be changed by the point 1).

If $`\overline{a}L_{U}^{}{}_{}{}^{ort}`$ then by the same reason we obtain the change of sign by the point 2).Hence $`\mathrm{Dist}_{closed}`$ changes a sign for all $`\overline{a}L^{}`$.

Now we can define $`\mathrm{Inv}`$:

$$\mathrm{Inv}=\mathrm{Check}\mathrm{Dist}_{ort}^{}\mathrm{Dist}_{closed}\mathrm{Dist}_{ort}\mathrm{Check}.$$

For $`aL^U,L^V`$ we have $`\mathrm{Inv}|a=|a`$ because $`\mathrm{Check}`$ gives zero in ancilla $`\alpha _U,\alpha _V`$ thus depriving the following operators ability to change somehow a state vector. If $`aL_0`$ then $`\mathrm{Inv}|a=|a`$ because $`\mathrm{Dist}_{ort}`$ makes nothing and $`\mathrm{Dist}_{closed}`$ makes nothing as well. Thus $`\mathrm{Inv}|a=|a`$ for $`\overline{a}L^{}`$, and $`\mathrm{Inv}|a=|a`$ for $`aL^{}`$.

Now we are ready to build an operator $`\mathrm{Dif}_{samedim}`$ inverting the ancilla $`\alpha _{samedim}`$ if and only if $`L^U`$ and $`L^V`$ are distinguishable. Let $`\mathrm{Gen}`$ generate a list $`y,[I_y],[C_Z]`$ where $`[C_Z]`$ is a code of circuit generating some unitary operator $`Z=Z^1`$ having only eigenvalues $`1`$ and $`1`$ that is its frequencies are $`0`$ and $`1/2`$ and the space corresponding to frequency $`0`$ is one dimensional where $`y`$ is its basic vector. As usually index $`j`$ means that the corresponding vectors $`y_j`$ are taken from the uniform distribution on all possible vectors. Assume that operators of the form $`\mathrm{Gen}^1`$ are accessible for us as well. Put

$$\begin{array}{c}\mathrm{Dif}_{samedim}=\underset{j}{}\left[\mathrm{GenTimeArg}_j^1\mathrm{Gen}_j^1(\mathrm{Inv}_jI_{y_j})^{t_j}\mathrm{Rest}_j^{Z_j}\right]\mathrm{Change}\hfill \\ \underset{j}{}\left[\mathrm{Rev}_j^{Z_j}(I_{y_j}\mathrm{Inv}_j)^{t_j}\mathrm{Gen}_j\mathrm{GenTimeArg}_j\right]\hfill \end{array}$$
(6)
where each copy of $`\mathrm{Inv}`$ acts on the register where initially is placed $`y_j`$ , $`\mathrm{Change}`$ makes a desired change in a resulting qubit $`\alpha _{samedim}`$ provided at least $`5/32`$ of all frequencies differ from $`0`$ in more than $`1/M`$.

The group $`(I_{y_j}\mathrm{Inv}_j)^{t_j}`$ of GSA type turns essentially a vector $`y_j`$ generated by $`\mathrm{Gen}_j`$ if and only if $`L^U`$ and $`L^V`$ are $`d`$\- distinguishable.

If $`L^U=L^V`$ then $`y_j`$ remains unchanged and at least $`7/8`$ of all frequencies will be closed to 0.

If $`L^UL^V`$ then for the result of the turn of $`y_j`$ at least $`\frac{7}{8}\frac{1}{4}=\frac{7}{32}`$ of frequencies will be far from 0 because they must be closed to $`1/2`$888Thus we could take any number $`\rho :\frac{1}{8}<\rho <\frac{7}{32}`$ instead of $`\frac{5}{32}`$ in the definition of $`\mathrm{Change}`$.

Definition of $`\mathrm{Dif}_{L^U>L^V}`$.

Suppose that $`dimL^U>dimL^V`$ and $`\mu _V<\sqrt{2/3}`$. Remind that here we have an expansion to the sum of orthogonal subspaces $`L^U=L_U^{\prime \prime }\mathrm{Proj}_{L^U}L^V`$ where $`L_U^{\prime \prime }\mathrm{}`$. We shall define the operator $`\mathrm{Dif}`$ by a very similar way as in previous case:

$$\begin{array}{c}\mathrm{Dif}_{L^U>L^V}=\underset{j}{}\left[\mathrm{GenTimeArg}_j^1\mathrm{Gen}_j^1(\mathrm{Inv}_{j,U}^{\prime \prime }I_{y_j})^{t_j}\mathrm{Rest}_j^{Z_j}\right]\mathrm{Change}\hfill \\ \underset{j}{}\left[\mathrm{Rev}_j^{Z_j}(I_{y_j}\mathrm{Inv}_{j,U}^{\prime \prime })^{t_j}\mathrm{Gen}_j\mathrm{GenTimeArg}_j\right]\hfill \end{array}$$

where the definition of $`\mathrm{Inv}_U^{\prime \prime }`$ inverting $`L_U^{\prime \prime }`$ looks like $`\mathrm{Dist}_{ort}`$ only $`L_U^{\prime \prime }`$ will play a role of $`L^{}`$:

$$\mathrm{Inv}_U^{\prime \prime }=\mathrm{Check}\left[\underset{k}{}\stackrel{~}{\mathrm{Res}}_k^V\right]\stackrel{~}{\mathrm{Si}}_\omega \left[\underset{k}{}\stackrel{~}{\mathrm{Re}}_k^V\right]\mathrm{Check}.$$

Here $`\stackrel{~}{\mathrm{Re}}^V`$ and $`\stackrel{~}{\mathrm{Res}}^V`$ act like $`\mathrm{Rev}^V`$ and $`\mathrm{Rest}^V`$ only if $`\alpha _U=1`$ and if $`\alpha _U=0`$ then they do nothing, $`\stackrel{~}{\mathrm{Si}}_\omega `$ changes a sign only in one case: if $`\alpha _U=1`$ and at least $`3/4`$ of all frequencies $`\omega _k`$ are far from $`\omega `$: $`|\omega _k\omega |1/M`$. Thus in $`\mathrm{Dif}`$ operator we shall use a set of ancillary registers enumerated by pairs of indices $`j,k`$.

For $`\overline{a}_j\mathrm{Proj}_{L^U}L^V`$ in view of $`\mu _V<\sqrt{2/3}`$ an operator $`\stackrel{~}{\mathrm{Si}}_\omega `$ does not change a sign because here the fraction of all frequencies closed to $`\omega `$ is $`\frac{7}{8}\frac{1}{3}=\frac{7}{24}>\frac{1}{4}`$.

For $`\overline{a}_j\mathrm{Proj}_{L^U}L^V`$ an operator $`\mathrm{Inv}_U^{\prime \prime }`$ makes nothing.

Definition of $`\mathrm{Dif}_{L^U>L^V}^{ort}`$

Suppose that $`dimL^U>dimL^V`$ and $`\mu _V>\sqrt{1/3}`$. The definition of $`\mathrm{Dif}`$ will be similar to the previous case only the whole subspace $`L_U`$ will play a role of $`L^{}`$:

$$\begin{array}{c}\mathrm{Dif}_{L^U>L^V}^{ort}=\underset{j}{}\left[\mathrm{GenTimeArg}_j^1\mathrm{Gen}_j^1(\mathrm{Inv}_{j,U}I_{y_j})^{t_j}\mathrm{Rest}_j^{Z_j}\right]\mathrm{Change}\hfill \\ \underset{j}{}\left[\mathrm{Rev}_j^{Z_j}(I_{y_j}\mathrm{Inv}_{j,U})^{t_j}\mathrm{Gen}_j\mathrm{GenTimeArg}_j\right]\hfill \end{array}$$

where

$$\mathrm{Inv}_U=\mathrm{Check}\left[\underset{k}{}\stackrel{~}{\mathrm{Res}}_k^V\right]\stackrel{~}{\mathrm{Si}}_\omega ^{ort}\left[\underset{k}{}\stackrel{~}{\mathrm{Re}}_k^V\right]\mathrm{Check}.$$

Here $`\stackrel{~}{\mathrm{Si}}_\omega ^{ort}`$ changes a sign if more than a half of frequencies are far from $`\omega `$: $`|\omega _j\omega |>1/M`$. The satisfying of the conditions required for $`\mathrm{Dif}`$ operator is based now on inequality $`\frac{7}{8}\frac{2}{3}=\frac{7}{12}>\frac{1}{2}`$ and can be checked straightforwardly.

At last estimate the complexity of constructed procedure. An operator $`\mathrm{Turn}`$ (5) requires of order $`\mathrm{Turn}_{complexity}=M\sqrt{1/d}`$ elementary steps. Then, $`\mathrm{Difference}`$ (4) requires of order $`\mathrm{Turn}_{complexity}\sqrt{N}`$ that is $`O(M\sqrt{N/d})`$ elementary steps. Note that there exists the similar form of operator $`\mathrm{Difference}`$ which does not act on resulting qubit $`\alpha _{dif}`$ but changes a sign instead and such operator can be constructed similarly. Denote this operator by $`\mathrm{Difference}_{sign}`$. Assume that an input of it contains a frequency $`\omega `$.

### 3.5 Recognition of electronic devices circuits

Now we are ready to take up the recognition of circuits. We assume that for every pair of circuits for their transformations $`U_1,U_2`$ subspaces spanned by corresponding eigenvalues are either coincident or $`d`$\- distinguishable. Assume also that our coding procedure gives one-to-one correspondence between circuits and $`T`$ basic states $`e_0,e_1,\mathrm{},e_{T1}`$ in the space $`H_{cir}`$. Recognizing procedure is denoted by $`\mathrm{Rec}`$ and will have the GSA form:

$$\mathrm{Rec}=(I_{\stackrel{~}{0}}I_U)^t,t=O(\sqrt{T})$$
(7)
acting on states of the form $`|\chi `$ where basic states for $`\chi `$ are codes of circuits. Here $`\stackrel{~}{0}H_{cir}`$ is chosen arbitrarily and $`I_U`$ inverts a sign of every code which circuit induces a given operator $`U`$. An implementation of $`I_{\stackrel{~}{0}}`$ is straightforward and all that we need is to build $`I_U`$.

We define $`I_U`$ as

$$I_U=\underset{j}{}\left[\mathrm{Conc}_{freq,j}^1\mathrm{Difference}_j\right]\mathrm{Sign}\underset{j}{}\left[\mathrm{Difference}_j\mathrm{Conc}_{freq,j}\right]$$

where $`\mathrm{Conc}_{freq}`$ for every basic state $`C`$ of argument will generate some arbitrary distribution of amplitude on ancillary register with $`Q`$ basic states and then will concentrate substantial part of amplitude on a frequency $`\omega `$ for which $`L^U`$ and $`L^V`$ are distinguishable (if such frequency exists). Then operator $`\mathrm{Difference}_j`$ changes resulting qubit for $`j`$th copy if and only if on this frequency these subspaces are distinguishable. The following operator $`\mathrm{Sign}`$ changes a sign if and only if at least one fifth of resulting qubits $`\alpha _{dif}`$ contain 1, e.g. if and only if operators $`U`$ and $`U_C`$ are the same. Then the following applications of $`\mathrm{Difference}_j`$ to each copy of register clean the corresponding resulting qubits and inverses operators for $`\mathrm{Conc}_j`$ restore an initial state of ancillary register. $`\mathrm{Difference}`$ was constructed in the previous section and all we need now is to build $`\mathrm{Conc}_{freq,j}`$. This transformation can be defined as

$$\mathrm{Conc}_{freq,j}=\mathrm{GenTimeFreq}_j^1\mathrm{GenFreq}_j^1(\mathrm{Difference}_{sign}I_{\omega _j})^{t_j}\mathrm{GenFreq}_j\mathrm{GenTimeFreq}_j$$
(8)
If $`U`$ and $`U_C`$ are different then by our assumption for some $`\omega `$ their subspaces $`L^U`$ and $`L^V`$ are $`d`$-distinguishable then $`\mathrm{Conc}_j`$ will concentrate substantially large part of amplitude over all $`j`$ on some combination of such values $`\omega `$. Thus we have constructed a required procedure $`\mathrm{Rec}`$ which gives a target code with substantial probability as a result of observation of the register for code $`C`$. After the observation we can verify a fitness of a code found $`C`$ by a straightforward procedure. It is similar to $`I_U`$ with the single change: $`\mathrm{Sign}`$ will be replaced by change in a special ancilla which can be observed after procedure and thus we shall learn does a code $`C`$ at hand fit or not.

What is the complexity of our procedure $`\mathrm{Rec}`$? The complexity $`Mn^2\sqrt{N/d}`$ of $`\mathrm{Difference}`$ must be multiplied by $`\sqrt{Q}`$ issued from (8) and by $`\sqrt{T}`$ issued from the immediate definition (7). The resulting complexity will be $`Mn^2\sqrt{TQN/d}`$.

### 3.6 Advantages of the recognizing algorithms

Advantages of the proposed algorithms are connected with their high speed and small memory. Particularly, the algorithm for molecular structures recognition makes possible to recognize molecular circuits using microscopic memory whereas classically this task requires exponentially large memory. Compare the proposed algorithms with their classical counterparts. We shall omit logarithmic multipliers.

1. Recognition of eigenvalues and finding thermodynamic functions. Fix some value of $`M`$ determining a precision of eigenvalue approximation. Consider at first the case when the number of ancillary qubits in a quantum gate array at hand is small. Then by the direct classical method we must build a matrix of unitary transform induced by a gate array. It requires of order $`N^3`$ steps and at least of order $`N^2`$ bits. The known quantum algorithm given by Travaglione and Milburn in \[TM\] basing plainly on Abrams and Lloyd operator $`\mathrm{Rev}`$ contains repeated measurements of frequencies hence it requires the time of order $`NM`$ \- for sparse spectrums it is of the same order as for Hams-Raedt algorithm and its only advantage over the last is exponential memory saving.

Our algorithm recognizes an eigenvalue in $`\sqrt{N}Mn`$ steps. This time for the sparse area of spectrum is about square root of the time of best known algorithms. Here the memory will be of order $`g^2`$ qubits ($`g`$ is the size of gate array), that is about squared memory used in \[AL\] but still exponentially smaller than of classical methods. Thus the proposed algorithm gives essential speedup over known methods in case when the number of ancillary qubits in a given gate array is small (as in case of molecular structure simulated by gate array) and an area of spectrum at hand is sparse. The same advantage we have with the proposed method of finding thermodynamic functions.

If spectrums are dense we assume that $`M=N`$ which means that eigenvalues differ at least on $`1/N`$. Then the time of our algorithm is $`O(N)`$.

Consider the case when the number $`a`$ of ancillary qubits involved simultaneously in the gate array is much more than the length $`n`$ of input. Then the direct classical method requires more than $`2^{2a}`$ steps and at least $`2^m`$ bits whereas our algorithm requires only about $`g2^n`$ steps and $`gn^2`$ memory and the quantum speedup may be more than square root.

2. The recognition of molecular structures. At first assume that spectrums are sparse. To be able to compare our method with the evident classical algorithm let us assume that a code of molecular circuit of the length $`n`$ is a string of ones and zeroes of this length. Thus $`M=N`$. The next natural assumption that may be also presumed for electronic circuits is that the sampling of a code of circuit from the uniform distribution induces a sampling of all possible spectrums from the uniform distribution as well. Then the number of all possible choices of spectrums approximations (or parts of spectrum subject to the statement of recognition problem) in within $`1/L`$ consisting of frequencies of the form $`l/M`$ is about $`2^M=N`$. It means that in our assumption $`M`$ and $`Q`$ must be logarithmic of $`N`$. Hence our method has the time complexity $`O(N)`$. With these assumptions the time complexity of the classical direct algorithm examining all codes and calculating the corresponding spectrums is about $`N^3N=N^4`$ whereas our algorithm requires the time about $`N`$ and logarithmic memory. Thus the quantum time for this problem is about fourth root of the time of classical direct method and quantum space is logarithmic.

If spectrums are dense then $`Q`$ and $`M`$ will be of order $`N`$ and our method requires the time $`O(N^{2.5})`$ comparatively with $`O(N^4)`$ of direct classical way.

3. Recognition of electronic devices. Here in the general case there are no classical analogs. Compare two algorithm constructed above with their classical and known quantum counterparts. At first consider the single recognizing quantum algorithm that can be easily deduced from the technique known before. This is an algorithm of recognizing a circuit realizing classical involutive function of the form $`f:QQ,f=f^1`$. This task can be reduced to the search of $`y`$ such that the following logic formula is true: $`xA(x,y)`$ where $`A(x,y)`$ is some predicate. Indeed, if we take $`Y(x)=U(x)`$ in place of $`A(x,y)`$ where $`Y`$ is a function whose code is $`y`$ then we just obtain the problem of recognition of circuit generating $`U`$. An algorithm for such formulas given in \[BCW\] has the time complexity of order $`\sqrt{TN}`$. This task is a particular case of our algorithm for involutive devices and it has the same complexity. In this particular case quantum time is of order square root of classical. But if we regard a bit more general but still restricted problem of recognition of involutive devices producing linear combinations of basic states (like quantum subroutines) an advantage over classical method of recognition will be more. For example, consider the restricted problem when we must choose between two alternative constructions of a tested device inducing not classical unitary transformation. The naive method of observing the results of action of a tested device on the different inputs requires of order $`\frac{1}{ϵ}N^3`$ steps to restore the matrix of the operator $`U_C`$ in within $`ϵ`$. Then this $`ϵ`$ must be less than $`1/\sqrt{N}`$ to give vanishing difference between operators in Hilbert space. Hence the time complexity of the naive method of recognition is roughly $`N^{7/2}`$. On the other hand the method proposed in the section 3.4 requires the choice of $`d`$ only converging to zero with $`N`$ converging to infinity. Thus the time required by our method is a little more than $`\sqrt{N}`$. We thus have almost seventh degree speedup for the problem of distinguishing electronic circuits generating transformations with not classical matrices.

## 4 Conclusion

The main conclusion is that molecular structure and physical properties of environment can be quickly recognized on the microscopic level whereas the classical methods require huge time and especially memory. The new algorithms recognizing eigenvalues with fixed precision and molecular structure, finding thermodynamic functions give a quadratic speedup comparatively with the best classical algorithms and exponential memory saving. The new method based on quantum computing was proposed for fast recognition of electronic devices. By this method two devices with the same given spectrum can be distinguished in the time about seventh root of the time of direct measurements. All these algorithms show essential potential advantages of microscopic sized quantum devices comparatively with their classical counterparts with much bigger memory. The advantages touch intellectual tasks like recognition of the structure of other devices and important properties of environment. The proposed algorithms are built of standard known subroutines; they have simple structure and lay completely in the framework of conventional paradigm of quantum computing.

## 5 Acknowledgements

I am sincerely grateful to Kamil Valiev for the creating of conditions for investigations in quantum computing in the Institute of Physics and Technology and for his attention and valuable advices concerning my work.


format: text

text:
# Varying c and particle horizons

## 1 Introduction

Recently proposals were advanced to solve the horizon and flatness problems of the standard big–bang cosmology -in a different way that inflationary picture does- as well as the cosmological constant problem by allowing the speed of light in vacuum and the Newtonian gravitational constant to vary with time . These approaches are collectivelly called varying speed of light (VSL) theories. Possible variations of the fundamental physical constants in the expanding Universe are currently of particular interest because of the implications of unified theories, such as string theory and M-theory . They predict that additional compact dimensions of space exist. The “constants” seen in our three–dimensional subspace of the theory will vary according to any variation in the scale lengths of the extra compact dimensions. While other scenarios with varying fundamental constants have been considered, like scalar–tensor theories of gravity (see, e.g., ) prescribing that $`G`$ must be function of a scalar field (the Brans–Dicke field) and the varying fine structure constant theory of Bekenstein , they do not touch the speed of light and respect Lorentz invariance. By contrast, certain fundamental theories, including strings, could admit spontaneous violation of CPT and Lorentz invariance . For instance, within string theory, quantum aspects of the interactions between particles and non–perturbative quantum fluctuations break supersymmetry and Lorentz invariance . It became an interesting issue to investigate the violation of Lorentz invariance in high energy phenomena . VSL theories also break Lorentz invariance rendering their approach non–covariant. They provide simple effective models to describe these effects.

In this letter we investigate what constraints the second law of thermodynamics may bring on the formulation of VSL theories, a point that to the best of our knowledge have received no attention so far. As it turns out these constraints are strong for homogeneous and isotropic spacetimes lacking of a particle horizon. However, for spacetimes possessing a particle horizon the restrictions are much less severe -at least at late time.

## 2 Field equations and constant attractor solution

Let us consider a expanding Friedmann–Lemaître–Robertson–Walker (FLRW) universe whose source of the gravitational field is a perfect fluid and assume that the speed of light in vacuum is not really a constant but varies time in some unknown manner, i.e., $`c=c(t)`$. The corresponding generalized “Einstein field equations” for a homogeneous and isotropic universe can be written as

$$H^2=\frac{8\pi G\rho }{3}\frac{kc^2(t)}{a^2},$$
(1)
$$\frac{\ddot{a}}{a}=\frac{4\pi G}{3}\left[\rho +\frac{3P}{c^2(t)}\right],$$
(2)
where $`H\dot{a}/a`$ is the Hubble factor, and $`k(=+1,0,1)`$ denotes the curvature of the spatial sections. Equation (1) implies that the energy density is not conserved as the universe expands

$$\dot{\rho }+3H\left(\rho +\frac{P}{c^2}\right)=\frac{3k}{4\pi G}\frac{c\dot{c}}{a^2}.$$
(3)
It therefore looks like as though the Universe were an “open system” in the thermodynamical sense. Here we shall explore some of its consequences.

It is generally accepted that the present matter density of the universe is below the critical value  -though voices of dissent can be heard . The density parameter $`\mathrm{\Omega }`$, defined as the ratio of the energy density of the universe with the critical density, $`\mathrm{\Omega }8\pi G\rho /(3H^2)`$, is one of the best-studied cosmological parameters and its low value is indicated by a number of independent methods for the study of clusters of galaxies. They include the mass-to-light ratio, the baryon fraction, the cluster abundance and the mass power spectrum. Thus, if the energy density of our Universe were dominated by clustered matter we would find the problem that a universe with $`\mathrm{\Omega }_0𝒪(1)`$ requires aextreme fine tuning of initial conditions. This is the flatness problem, and it can find a solution within the VSL framework without invoking inflationary fields. By using the above $`\mathrm{\Omega }`$ expression in (1), differentiating it with respect to time and resorting to (3), the evolution equation

$$\dot{\mathrm{\Omega }}=(\mathrm{\Omega }1)\left[\left(1+\frac{3P}{\rho c^2}\right)+\frac{2\dot{c}}{c}\right]f(\mathrm{\Omega })$$
(4)
follows. For $`\dot{c}0`$ it has two constant solutions, namely $`\mathrm{\Omega }=1`$, which is unstable, and $`\mathrm{\Omega }_{}`$. The latter arises when the square parenthesis in (4) vanishes. Our interest focuses on it because it is stable -since $`[f(\mathrm{\Omega })/\mathrm{\Omega }]_\mathrm{\Omega }_{}<0`$-, and is an attractor of the system. For $`\mathrm{\Omega }=\mathrm{\Omega }_{}`$ the speed of light obeys the law

$$c(a)=c_1a^\mathrm{\Omega }_{}\mathrm{exp}\left[\frac{3\mathrm{\Omega }_{}}{2}𝑑t\left(1+\frac{P}{\rho c^2}\right)H\right].$$
(5)
We note that this expression leads to a decreasing speed of light provided that the dominant energy condition holds. Equation (3) can be solved by using (5)

$$\rho (t)=\frac{\rho _1}{G}a^{2\left(\mathrm{\Omega }_{}1\right)}\mathrm{exp}\left[3\mathrm{\Omega }_{}𝑑t\left(1+\frac{P}{\rho c^2}\right)H\right],$$
(6)
hence it follows that $`\rho =\rho _1c^2/(Gc_1^2a^2)`$. By combining it with (1) a relationship between the density parameter and the integration constants can be obtained, namely

$$\mathrm{\Omega }_{}=\left[1\frac{3kc_1^2}{8\pi \rho _1}\right]^1,$$
(7)
and by virtue of (1) the scale factor can be written in terms of the speed of light

$$a(t)=\sqrt{\frac{k}{\mathrm{\Omega }_{}1}}c(t)𝑑t.$$
(8)
In the particular case of a linear barotropic equation of state $`P=\left(\gamma 1\right)\rho c^2(t)`$ with constant adiabatic index $`\gamma `$, it follows that

$$c(a)=c_1a^\beta ,$$
(9)
$$\mathrm{\Omega }_{}=\frac{2\beta }{23\gamma },$$
(10)
where use of (5) has been made.

For ordinary fluids the strong energy condition (SEC) holds. This implies $`\gamma >2/3`$, thereby $`\beta <0`$ for $`\mathrm{\Omega }_{}>0`$. From (8) the scale factor is

$$a(t)=\left[\left(1\beta \right)c_1\sqrt{\frac{k}{\mathrm{\Omega }_{}1}}t\right]^{\frac{1}{1\beta }}a_1t^{\frac{1}{1\beta }}.$$
(11)
## 3 Entropy considerations

Let us assume that the number of particles in a comoving volume is conserved (i.e., $`Nna^3=`$ constant), then the particle number density obeys

$$\dot{n}+3Hn=0.$$
(12)
This combined with Gibbs equation

$$nT\dot{s}=\dot{\rho }\left(\rho +\frac{P}{c^2}\right)\frac{\dot{n}}{n},$$
(13)
where $`s`$ is the entropy per particle and $`T`$ the fluid temperature, leads to

$$nT\dot{s}=\dot{\rho }+3H\left(\rho +\frac{P}{c^2}\right).$$
(14)
From (3) and (14) it follows that

$$nT\dot{s}=\frac{3k}{4\pi G}\frac{c\dot{c}}{a^2}.$$
(15)
Note that the entropy variation implied by last equation cannot be attributed either to dissipative processes (since the fluid is perfect) or particles production (for $`N`$ is a constant). We are led to conclude that the variation of $`c`$ entails that the entropy of the fluid must vary. This may be justified -at least naively. An increase in $`c`$ means a widening of the past light cone of the observers. Automatically they acquire more information and the entropy decreases accordingly . That is to say, $`\dot{c}<0\dot{s}>0`$ as well as $`\dot{c}>0\dot{s}<0`$. This together with (15) implies that $`c`$ cannot increase in open universes (k = -1), and that flat and closed universes don’t admit $`\dot{c}0`$.

The consequences are rather restrictive for cosmological models with varying speed of light. The only admisible FLRW model with $`\dot{c}0`$ is the open one. Obviously, one may always introduce some traditional source of entropy such a viscous dissipation (only that in such a case the fluid is no longer perfect), or perhaps particle production from the quantum vacuum; but this complicates matters and we wish to keep the discussion as simple as possible.

Note, by passing, that not every fluid is consistent with $`\dot{c}0`$. Think, for instance, in a radiation fluid -equation of state $`P=\rho c^2/3`$. There one has

$$s=\frac{\rho +(P/c^2)}{nT}=\frac{4\rho }{3nT}=\frac{8}{45}\frac{\pi k_B}{\zeta (3)},$$

and accordingly $`\dot{s}=0`$. Therefore, in view of (15) -barring a flat FRW- a pure radiation fluid cannot act as the gravitational source of a cosmology with $`\dot{c}0`$.

As is well–known, particle horizons may occur quite naturally in cosmological models and these have associated an entropy by a formula formally identical to that of event horizons (either black hole or cosmological)

$$S_H=\frac{k_B}{4}\frac{A}{l_{Pl}^2},$$
(16)
where $`k_B`$ is the Boltzmann constant, $`l_{Pl}(G\mathrm{}/c^3)^{1/2}`$ the Planck’s length, and $`A`$ the area of the horizon. The latter is given by $`A=4\pi l_H^2`$, with

$$l_H=a(t)_0^t\frac{c(t^{})}{a(t^{})}\text{d}t^{}.$$
(17)
Particle horizons exist provided the integral does not diverge. The rationale behind attaching an entropy to a particle horizon is that the area is a measure of the lack of knowledge of the observer about the conditions prevailing in the universe beyond the horizon.

If a FLRW universe filled with a perfect fluid has a particle horizon, the generalized second law (GSL) of thermodynamics (firstly devised for black holes in causal contact with its environment and later extended to cosmological settings) states that the entropy in the fluid enclosed by the horizon plus the entropy of the horizon cannot decrease in time

$$\dot{S}_f+\dot{S}_H0.$$
(18)
Here $`S_f=(4\pi /3)l_H^3ns`$. It is natural to expect that (18) restricts the temporal dependence of $`c`$ less severely than the corresponding expression in the absence of horizons (i.e., when $`S_H=0`$). Taking into account that $`\dot{l}_H=Hl_H+c`$, and that $`(l_H/a)^.=c/a`$, the GSL takes the form

$$4\pi Nc\left(\frac{l_H}{a}\right)^3\left[\frac{s}{l_H}+\frac{k\dot{c}a}{4\pi NTG}\right]+\frac{\pi k_B}{G\mathrm{}}c^2\left[(2cH+3\dot{c})l_H^2+2c^2l_H\right]0.$$
(19)
To draw specific consequences of last equation, we use the constant attractor solution $`\mathrm{\Omega }=\mathrm{\Omega }_{}`$ given by (9) and (11). As we are considering just classical fluids and the horizon entropy is semiclassical in nature we may leave aside any consideration of an early quantum phase. Hence to restrict ourselves to the classical era we replace the lower index of the integral in (17) by some initial time $`t_{cl}(>0)`$ which corresponds to the commencement of the the aforesaid era. As a consequence

$$l_H=\frac{c_1}{a_1^\beta }t^{1/(1\beta )}\mathrm{ln}\frac{t}{t_{cl}}$$
(20)
remains finite and a horizon exists. One may held the view that by introducing a lower cutoff we illegitimately provide a horizon to an otherwise horizon–free universe. In keeping with that view the very restrictive consequences for $`c(t)`$ spelled above should apply. By contrast, the more liberal view that the cutoff is admissible since any observer travelling backward in time will eventually hit the quantum era (in which -presumably- the space–time ceases to be a continuum and the observer should see a foam–like structure with the light cones taking random orientations ), gives a reasonable chance to relax those consequences.

To obtain $`\dot{S}_f`$ we must must know the temperature evolution. The latter is governed by

$$\frac{\dot{T}}{T}=3H\left(\frac{p/T}{\rho /T}\right)_n+\frac{n\dot{s}}{(\rho /T)_n},$$
(21)
therefore a positive specific entropy variation implies that in an expanding universe the temperature will decrease more slowly with a declining speed of light. Here we will consider two limiting cases at late time: monoatomic nonrelativistic mater, and radiation.

(i) In the first case, $`\rho =mn+(3/2)nT`$ and $`P/c^2=nT`$, equation (21) reduces to

$$\frac{\dot{T}}{T}=2H\left(1\frac{k\left(\mathrm{\Omega }_{}1\right)^2}{4\pi Gn_1T}a^2\dot{a}\ddot{a}\right),$$
(22)
and its general solution is

$$T(t)=T_1t^{2/(1\beta )}+T_2t^{2(2\beta 1)/(1\beta )},$$
(23)
where $`n_1`$, $`T_1`$ are positive constants and $`T_2`$ depends on the previously defined parameters. In the large time limit the homogeneous part becomes dominant (i.e., $`Ta^2`$ exactly like in a constant speed of light cosmology), and combination with (15) leads to

$$s(t)=s_1t^{(2\beta +3)/(1\beta )}.$$
(24)
Then, for $`t\mathrm{}`$, $`S_Ht^{5/(1\beta )}\mathrm{ln}^2t`$, $`S_ft^{(2\beta +3)/(1\beta )}\mathrm{ln}^3t`$ and $`S_H`$ dominates over $`S_f`$, so that (18) is satisfied.

(ii) In the second case, $`\rho =c_2T^4`$ and $`P=\rho c^2/3`$, equation (21) becomes

$$\frac{\dot{T}}{T}=\left[1\frac{3k\left(\mathrm{\Omega }_{}1\right)^2}{4c_2GT^4}\frac{\dot{a}^2\ddot{a}}{a}\right]H,$$
(25)
with general solution

$$T(t)=\left[T_1t^{4/(1\beta )}+T_2t^{2(2\beta 1)/(1\beta )}\right]^{1/4},$$
(26)
where $`T_1`$ is a positive constant and $`T_2`$ depends on the previously defined parameters. For $`t\mathrm{}`$ two cases arise. When $`1<\beta <1/2`$, $`T1/a`$ as in standard cosmology, and when $`1/2<\beta <0`$, one has $`Ta^{(2\beta 1)/2}`$. In the first case $`S_ft^{2(1+\beta )/(1\beta )}\mathrm{ln}^3t`$, while in the second $`S_ft^{(2\beta +3)/2(1\beta )}\mathrm{ln}^3t`$. Again $`S_H`$ dominates $`S_f`$ and the GSL is satisfied in both instances.

## 4 Concluding remarks

We have seen that the second law of thermodynamics implies rather severe restrictions on $`c(t)`$ in FLRW cosmologies free of particle horizons. Specifically, in open universes $`c(t)`$ cannot augment, and in flat and closed universes $`c`$ must stay constant. Nonetheless, the presence of a particle horizon renders the situation less acute. In particular, for the constant atractor solution of section II, the GSL is fulfilled at late time both for non-relativistic monoatomic fluids and extreme relativistic fluids. A similar study for other cosmological solutions should be a worthy undertake.

This work has been partially supported by the Spanish Ministry of Science and Technology under grant BFM 2000-0351-C03-01. L.P.C. and A.S.J. thank the University of Buenos Aires for partial support under project TX-93.