scieee AI-readable full text Open interactive document viewer

Finding eigenvectors with a quantum variational algorithm

García Escartín, Juan Carlos

Abstract

Producción Científica

Full text

Quantum Information Processing (2024) 23:254 https://doi.org/10.1007/s11128-024-04461-3 Finding eigenvectors with a quantum variational algorithm Juan Carlos Garcia-Escartin1 Received: 26 February 2024 / Accepted: 10 June 2024 / Published online: 25 June 2024 © The Author(s) 2024 Abstract This paper presents a hybrid variational quantum algorithm that finds a random eigenvector of a unitary matrix with a known quantum circuit. The algorithm is based on the SWAP test on trial states generated by a parametrized quantum circuit. The eigenvector is described by a compact set of classical parameters that can be used to reproduce the found approximation to the eigenstate on demand. This variational eigenvector finder can be adapted to solve the generalized eigenvalue problem, to find the eigenvectors of normal matrices and to perform quantum principal component analysis on unknown input mixed states. These algorithms can all be run with low-depth quantum circuits, suitable for an efficient implementation on noisy intermediate-scale quantum computers and, with some restrictions, on linear optical systems. In full-scale quantum computers, where there might be optimization problems due to barren plateaus in larger systems, the proposed algorithms can be used as a primitive to boost known quantum algorithms. Limitations and potential applications are discussed. Keywords Quantum algorithms ·Variational algorithms ·Hybrid quantum algorithms ·Eigenvectors ·Quantum principal component analysis ·SWAP test 1 Introduction: Noisy intermediate-scale quantum computers and hybrid algorithms Scalable general-purpose quantum computers could run algorithms that are more efficientthananyclassicalalternative [1,2]. However,atthepresentmoment,theavailable technology is restricted to computers with a moderate number of qubits with a varying degree of noise. These computers are usually dubbed noisy intermediate-scale quantum computers, NISQC [3,4]. In this scenario, there has been a growing interest on hybrid quantum-classical algorithms [5–7] where part of the work is shifted to a classical computer. In most cases there is a continuous feedback between the classical and the quantum computer, BJuan Carlos Garcia-Escartin [email protected]a.es 1Dpto. Teoría de la Señal e Ing. Telemática, Universidad de Valladolid , Paseo Belén no 15, 47011 Valladolid, Spain 123 254 Page 2 of 24 J. C. Garcia-Escartin whichhasquantumcircuitsthatareafunctionofafewparameterswhichareupdatedin theclassicalpartofthealgorithmaccordingtotheresultsofthequantummeasurements from previous stages. These algorithms are particularly useful in problems dealing with large state spaces which can be sampled quickly on a quantum computer without the need to explicitly write out the whole state, which has a size that grows exponentially with the size of the problem. A good example is quantum simulation, one of the most promising applications of quantum computing. For instance, in molecular simulation, the variational quantum eigensolver can efficiently search for a particular state in the Hilbert space of nqubits, which grows exponentially with the size of the problem, and still achieve reasonable results even in the presence of noise [8–10]. This approach based on using quantum circuits with a classical control also plays a key role in quantum machine learning [11–15]. In this paper, I present an application of these concepts to the search for an eigenvalue of a known unitary which can be generalized to different kinds of matrices with some restrictions. The algorithm is based on a modified version the SWAP test for state comparison and can be realized with circuits of a low depth (with few consecutive elementary gates). We only require a state preparation phase, a circuit for Uand one CNOT gate and one Hadamard gate for each qubit on which Uacts. At the end of the process, we obtain a list of classical parameters that can produce a good approximation to a random eigenvector of the desired matrix using a known classically controlled quantum circuit. The same method can be adapted to perform quantum principal component analysis of an unknown mixed state, which can be cast as a problem of finding the eigenvectors of a Hermitian matrix. The paper starts with a brief reminder of the SWAP test for quantum state comparison and some hardware-efficient optimizations in Sect.2, followed by an explanation of the notation and methods of hybrid algorithms in Sect.3. The core quantum variational eigenvector finder algorithm is presented in Sect.4, including modifications to solve the generalized eigenvalue problem (Sect.4.1) and to find the eigenstates of general normal matrices instead of just unitaries (Sect.4.2). Section5shows how to adapt the variational eigenvector finder for quantum principal component analysis. Section 6proposes an alternative implementation in optical systems instead of the usual quantum circuit model. Section7compares the proposed quantum variational algorithms to similar variational algorithms for the same problems commenting the advantages of each method. Finally, Sect.8discusses the strong and weak points of the variational approach for eigenvector determination and comments some potential applications in the short and long terms. 2 The SWAP test While it is impossible to tell apart with certainty two quantum states which are not orthogonal, there are methods that can tell us if they are equal or not with a certain 123 Finding eigenvectors with a... Page 3 of 24 254 Fig. 1 Quantum circuit realizing the SWAP test. The crossed lines represent qubit registers with n qubits probability. The SWAP test [16,17] permits a simple comparison. We start with two arbitrary nqubit states |ψand |φand an ancillary qubit initially in the state |0.The quantum circuit corresponding to the test is shown in Fig.1. The evolution in that circuit is |0|φ|ψH −→ |0+|1 √2|φ|ψ CSWAP −→ 1 √2(|0|φ|ψ+|1|ψ|φ)H −→ |out=|0(|φ|ψ+|ψ|φ)+|1(|φ|ψ−|ψ|φ) 2. (1) If we measure the ancillary qubit after the last Hadamard gate, the probability of finding the state |0is associated with the eigenvalue 1 of the observable Z=|00|−|11|=P0−P1(2) for the projectors to the |0and |1states P0and P1. For the output state |outthe probability of measuring the |0state in the ancillary qubit is P(0)=out|P0|out=1+|ψ|φ|2 2(3) and the average value of the Zobservable for the first qubit becomes Z=|ψ|φ|2.(4) For two identical states, the SWAP operation SW AP |ψ|φ=|φ|ψ(5) does not change the state and the value of the control qubit is irrelevant. The two Hadamard gates on the ancillary qubit cancel and the whole circuit is equivalent to the identity. We can see from Eq. (1) that when both states are the same |ψ=|φ, there is a destructive interference between the terms entangled to the ancillary qubit state |1. The result from the measurement is always |0and whenever we get that result we say the SWAP test has been passed. However, if the states are different, each part of the uniform superposition of the ancillary qubit becomes entangled to a different state. In that case, there is always a probability greater than zero of measuring the state |1. In a noiseless system, failing 123 254 Page 4 of 24 J. C. Garcia-Escartin to pass the test shows with certainty the input states are different. The probability of finding a |1ancillary qubit on measurement grows as the input states become more different. Ifwehave kcopies of thesame states and repeat thetestktimes, even for very close states with an overlap |ψ|φ|=1−with 1, P(0)=1+(1−)2 2≈(1−) and we have a probability of passing the test P(0)k≈1−k. With enough repetitions, if we never fail the test, we can be confident that the two input states are the same or, at least, very close. As expected, global phases do not change the result of the test. Two inputs |ψand ei|ψ, for an arbitrary phase , will act exactly in the same way under the test. This is the desired operation. While a larger circuit with a reference can distinguish between these two states, if these inputs were isolated states, there is no physical measurement that could tell them apart. The comparison in the SWAP test is also valid for general inputs with mixed states. We consider an ensemble given by the density matrix ρ= m  i pi|ψiψi|(6) where we have a statistical mixture of finding a pure state |ψiwith a probability pi for each. For two mixed states with density matrices ρand σthe probability of passing the test becomes: P(0)=1+tr(ρσ ) 2(7) where tr(ρσ ) replaces |ψ|φ|2[18]. When both states are pure states with ρ= |ψψ|and σ=|φφ|we recover the original overlap. 2.1 The destructive SWAP test The depth of the SWAP test circuit can be reduced if we notice that, after the test, the original inputs become entangled and they are discarded. The total number of elementary gates needed to perform a SWAP test can be reduced to 2nfor nqubits. Most importantly, we only need two stages. This is the destructive SWAP test explained in [19], which was later rediscovered by an AI driven search [20]. We can check the test is valid starting from the SWAP circuit for two qubits shown in Fig.2a. The SWAP operation is performed with three CNOT gates. A sequence of 3 CNOT gates can perform classical XOR swapping [21] for two bits in the computational basis x,y∈F2so that |x|yCNOT(2,1) −→ |x⊕y|yCNOT(1,2) −→ |x⊕y|y⊕x⊕y=|x⊕y|x CNOT(2,1) −→ |x⊕y⊕x|x=|y|x(8) 123 Finding eigenvectors with a... Page 5 of 24 254 Fig. 2 Equivalent circuits for the SWAP test on single qubit states where CNOT(i,j) is controlled by the ith qubit and has the jth qubit as target. The result follows from two properties the XOR operation ⊕(equivalent to modulo 2 addition): x⊕x=0 and x⊕0=x. If the middle CNOT is replaced by a Toffoli gate controlled by the ancillary qubit in the SWAP test, we have a controlled SWAP operation. When the ancilla has a state |1the middle Toffoli gate is equivalent to a CNOT gate on the inputs and we recover the 3 CNOTs of the SWAP circuit. When it is |0the two consecutive CNOT gates cancel each other and we have the identity. The NOT operation can be decomposed as X=HZH and we can convert CNOT gates into CZ gates surrounded by two Hadamard gates. The Toffoli gate becomes a doubly controlled Z gate with operation CCZ |x|y|z=(−1)x·y·z|x|y|zwhere the sign change only happens if all the qubits have a 1. In that sense, any of the qubits canbeconsideredto be the target.Putting alltogether,wecan find a series of equivalent circuits shown in Fig. 2b–d. Now, starting from Fig.2d, we can notice that changes on the input qubits after the Toffoli gate do not affect the state of the ancillary qubit. We might just as well measure both qubits right after the Toffoli. Finally, there is a further simplification if we notice that the ancillary qubit will result in a |0unless both control qubits from the inputs areinstate|1. The result of measuring the two input qubits at this point perfectly determines the state of the ancillary qubit, which can be removed. If we measure in the computational basis (observable Z), we can associate a measurement finding a |0state to a bit 0 (Z’s eigenvalue 1) and finding state |1to a bit 1 (Z’s eigenvalue −1). The logical AND of the measurement results reproduces the result of measuring the ancillary qubit. A measurement on the input qubits and classical computation (the AND operation) return the same statistics as measuring the Zobservable for the ancilla. The same reasoning can be applied to multiple qubits. In that case, the SWAP operation has the same decomposition for each pair of qubits of the multiqubit state. We group the first qubit of |φ,q1 φ, with the first qubit of |ψ,q1 ψ, and continue forming all the n(qi φ,qi ψ)pairs for 1 ≤i≤n.Fornqubit states, the simplified circuit in Fig.2d would have the same CNOT and Hadamard gates in the corresponding qubit pairs and a Toffoli gate controlled by them and acting on the ancillary qubit. There is a total of nToffolis that change the state of the input from |0to |1or from |1to |0when both controls are |1. The final value depends on the parity of the bitwise AND, ∧,of 123 254 Page 6 of 24 J. C. Garcia-Escartin the strings coming from measuring the nqubits of each input state. An even number of ones means the output state in the ancillary qubit would have been |0(a pass). An odd number of ones corresponds to failing the test. In terms of the Zobservable of the ancillary qubit, the measurement result is exactly the same as the product of the measurement results for the CZobservable on each pair. For two qubits, the CZ operation has eigenvectors |00,|01,|10associated with eigenvalue 1 and an eigenvector |11associated with eigenvalue −1. The product of these CZ observables has the same value as a measurement of the observable Zin the SWAP test. Considering all the qubits, the observable with the result of the destructive SWAP test is CZ⊗nif we write our inputs in the order q1 φq1 ψq2 φq2 ψ···qn φqn ψ. Finding a 1 eigenvalue corresponds to passing the test. Measuring eigenvalue −1 indicates a failure. 3 Hybrid algorithms: variational methods Physical quantum computers are difficult to build. They have a high cost of operation when compared to classical computers and, in their current implementations, are still too prone to decoherence to be able to carry out long calculations. For all these reasons, whenever possible, we would like to replace the quantum parts of the algorithm by classical computation. For instance, in Shor’s algorithm for integer factorization [1], the only part that needs a quantum computer is the order finding subroutine. As shown by Ekerå [22], a classical computer can perform a longer preprocessing stage and the quantum computer can be reserved for a single use of the non-classical routine for order finding. Even this simplified form of factoring still requires a number of qubits and consecutive stages beyond the capabilities of current noisy quantum computers. The first promising results of real-world quantum computers come from hybrid algorithmswherethequantum andtheclassical stagesfeedeach other.Oneparticularly successful family of algorithms are variational methods taking advantage of the native capacity of a quantum computer to describe states in a large space without needing to store an exponential amount of data [8,10]. For instance, if we want to compute the ground state energy Egof a particular Hamiltonian, H, classical variational methods propose a series of trial states. For any state |ψ, the expected energy value ψ|H|ψ≥Eggives an upper bound to the minimal energy of the ground state. If we choose with care the states for which we measure the energy, we can approximate Egwith good precision. Quantum methods offer a compact way to perform variational algorithms. We no longer need to write down the whole state vector of the ground state, which can have a number of complex elements growing exponentially with the size of the problem. For instance, a simple system with nelectrons in separate sites can have 2nspin configurations. Most variational hybrid algorithms can be described using four main blocks. We will describe them in parallel with an example application for ground state estimation for a Hamiltonian made of a combination of Pauli operators (Fig.3). The four blocks are: 123 Finding eigenvectors with a... Page 7 of 24 254 Fig. 3 Example for three qubits ψ( θ)|Z⊗X⊗Z|ψ( θ) •A parametrized quantum circuit P( θ): The gates in the circuit depend on a list of classical parameters  θ=(θ1,...,θ k) to prepare a trial state, or ansatz,|ψ( θ). We assume a fixed initial state, usually with the nqubits initialized to |0so that P( θ)|0⊗n=|ψ( θ). In the example of Fig.3, the classical parameters appear in a series of rotation gates RX and RY which rotate a single qubit with respect to the Xand Yaxis of the Bloch sphere, respectively, by an angle determined by a classical parameter. There are also two CNOT gates that introduce entanglement in the final state. This circuit follows the approach of what is called a hardware-efficient Ansatz [23], where the gates are selected to give the shallower possible circuit that still can approximate the desired state. •A processing circuit: Depending on the desired target, we need to act on the ansatz in different ways. The measurement stage must return values related to an objective function scoring how close we are to our goal. The example in Fig.3shows a typical variational simulation scenario where the gates perform a change of basis so that the final measurements correspond to one term of the desired Hamiltonian in a particular encoding. In this case, the Hgate in the middle qubit and the identity in the rest make the final measurement in the computational basis give the exact same results as measuring the Z⊗X⊗Z observable for the generated ansatz |ψ( θ). •Measurement: We usually consider measurement in the computational basis {|0,|1}for each qubit. As a single measurement is not enough to estimate the desired averages, we needto prepare multiplecopies of the same trialstate using theexactsame classical parameters and processing circuit so that we can get meaningful statistics. This stage has been considered together with the processing circuit in the example. •Classical processing and feedback: After a few repetitions, the statistics from the measurement are used to compute an objective function f ( θ)which takes a value which depends on the chosen classical parameters and is related to the problem we want to solve. This dependence is, in general, quite complex. Using a quantum circuit we reduce an explicit description of the problem to measuring a small experimental setup. The global process is a loop that takes the estimated value of the objective function f( θ) at each iteration as a guide to tweak the classical parameters  θ.Inmost 123 254 Page 8 of 24 J. C. Garcia-Escartin cases, the problem is posed as a minimization problem where we use classical optimization methods (such as nonlinear optimization or gradient descent methods) changing the input parameters at stage kto new values  θkuntil we find a stable value f( θs)at iteration swhich is assumed to be the minimum. In the example, the expected value ψ( θ)|Z⊗X⊗Z|ψ( θ), which approximates the energy of |ψ( θ)for the simulated Hamiltonian, is the objective function to be minimized. The classical part starts by choosing a random initial list of parameters  θ1that gives a first value f( θ1). The chosen optimization method then generates a new set of classical parameters  θ2that are fed into the parametrized quantum circuit. After we complete the second round of measurements, the new value of the objective function f( θ2)is compared to the previous one. The changes in the parameters that lead to a smaller final value are kept and the ones that increase the objective function are modified until we can no longer find a better solution. This part of the hybrid algorithm draws heavily on classical optimization and there are multiple available software libraries, like Python’s scikit-learn [24]. Notice that, in many cases, we have no guarantee that the algorithm will succeed. Still, we can provide educated guesses for the solution, similar to what happens in many classical machine learning methods. The main advantage of this family of hybrid algorithms is the possibility to probe a large state space with a quantum circuit that grows linearly instead of exponentially with the size of the system. This is particularly interesting in the simulation of quantum systems, where the states of the simulated system can be easily mapped into the quantum computer. For instance, chains of nfermions with spin 1/2or−1/2 can be directly represented by nqubits in the state |0or |1and we can directly explore the Hilbert space of dimension 2nwith a compact system and study, among others, phase transitions in the Ising model [25]. A good review of existing applications can be found in [10]. 4 A variational method for the eigenvectors of unitary matrices The SWAP test gives a suitable objective function for a hybrid variational algorithm that finds the eigenstates |eiof a unitary evolution Usuch that U|ei=λi|ei.The method can be generalized to multiple scenarios. For an N×Nunitary U, we can find Northogonal eigenvectors |eiwhich form an orthonormalbasisandtheir corresponding eigenvaluesλi=eiφiarecomplexnumbers of modulus 1. The circuit for the quantum part of the algorithm is shown in Fig.4.Weusethe same parametrized circuit P( θ) with the same classical parameters twice to generate a trial state |ψ( θ)|ψ( θ), which is transformed by the unitary into |ψ( θ)U|ψ( θ) and then proceeds to a destructive SWAP test circuit. The objective function in the algorithm comes from the statistics of the SWAP test and can be written as f( θ) =P(0)−P(1)=|ψ( θ)|U|ψ( θ)|2.(9) 123 Finding eigenvectors with a... Page 9 of 24 254 Fig. 4 Variational quantum circuit for the eigenvectors of U We approximate the probabilities of passing and failing the SWAP test, P(0)and P(1), respectively, from counting how many times we get each outcome and dividing by the total number of times we run the test. The 0 and 1 results correspond to the parity of the bitwise AND of the measurement results in the computational basis (assuming 0for|0and 1 for |1) and they have the same statistics that would appear if we had measured the ancillary qubit in the complete SWAP test. The evaluation of the objective function is reduced to computing the expected value of the Zobservable for the ancillary qubit, albeit in a roundabout way to reduce the final number of gates. The objective function is an inner product of normalized states, with f( θ) ≤1, and we can see that the maximum is obtained only if the trial state is an eigenvector of U, |ψ( θ)=|ei. Then f( θ) =|ei|U|ei|2=|ei|λi|ei|2=1.(10) Most optimization methods and software libraries work by minimizing a function. For these, we can consider: f( θ) =P(1)−P(0)=−|ψ( θ)|U|ψ( θ)|2(11) or f( θ) =1 f( θ) =1 P(0)−P(1).(12) With these functions that can be computed from measurements on the circuit, we can use a classical optimization method to update the parameters  θuntil the parametrized circuitgiving P( θ)produces a good approximationtoaneigenstate of the targetunitary U. 123 254 Page 16 of 24 J. C. Garcia-Escartin Sinto the optical system in order to find a compact description of its eigenvectors, as, in this case with a single photon, U=S. While the scalability of this approach is limited, it can be an interesting alternative to full quantum computers in the near term, particularly in the cases where we need a low noise implementation. Photons have long coherence times, relatively low noise and do not need advanced cooling systems unlike many implementations of quantum computers, especially those based on superconducting qubits. Optical systems have their own problems like losses, synchronization or producing good approximations to single photon states, but, for most of these problems, there are acceptable technical solutions that have been used in quantum key distribution systems [65,66]. 7 Comparison to other variational quantum algorithms for eigenvector determination There exist various proposals for variational quantum algorithms that learn an eigenstate of a Hamiltonian, a density matrix or a general matrix, each focusing on different objectives. The main motivation of the algorithms put forward in this paper is to reduce as much as possible the depth of final quantum circuit. Noisy intermediate-scale quantum computers are the natural hardware to run the quantum part of hybrid variational quantum algorithms. However, variational methods are severely limited by the noise in each quantum gate. A first strong limitation is that there is a bound to the maximum depth for which variational algorithms give genuine quantum advantage [67]. Above a certain depth threshold, which depends on the noise level, classical Monte Carlo techniques offer an efficient simulation of the quantum variational method. Even if the results are correct despite the noise, the problems that can be solved in this case can also be solved, without all the specialized hardware, using a classical computer. A second important limitation comes from the classical optimization phase. Noise introduces barren plateaus in the optimization landscape [68]: the gradient vanishes exponentially with the depth of the parametrized circuit generating the ansatz. This makes classical optimization unfeasible. The search for a global minimum of the cost function will get stuck at some sub-optimal parameters. We can compare the proposed variational methods to previous algorithms in terms of the depth of the circuits. We have approximated the overlap |ψ( θ)|U|ψ( θ)| comparing two states U|ψ( θ)| = UP( θ)|0|⊗nand |ψ( θ)| = P( θ)|0|⊗nusing the SWAP test. However, we can just take an initial all-zeroes state and make it evolve under P†( θ)UP( θ) [69]. If we project the resulting state to the |0⊗noutput, the statistics for finding all the output qubits in |0are n⊗0|P†( θ)UP( θ)|0⊗nwhich is exactly |ψ( θ)|U|ψ( θ)|. This approach has advantages and disadvantages with respect to using the SWAP test. The biggest advantage is that is only uses nqubits for 2n×2nunitaries instead of 2nqubits and does not require any additional gates. In the proposed destructive SWAP test the overhead of the SWAP test reduces to two gates per qubit pair, which is not 123 Finding eigenvectors with a... Page 17 of 24 254 so important. The qubit advantage is not trivial, though, particularly for intermediatescale applications where qubits are scarce. However, the additional circuit depth due to including P( θ) can be important, as the performance of variational algorithms can degrade exponentially with the total circuit depth [68] and deep noisy circuits can loose quantum advantage [67]. There are also other variational methods that assume a known Hamiltonian that can be efficiently written in the Pauli basis [70,71]. For eigenstates, the cost function C( θ) =ψ( θ)H2ψ( θ)−ψ( θ)Hψ( θ)2(23) is equal to zero and can be used to tune the parameters in P( θ). This only requires n qubits for a Hamiltonian corresponding to a 2n×2nmatrix. The additional cost of measuring the corresponding Pauli operators is small (at most a change of basis gate on each qubit). This can be more efficient than the SWAP test eigenvector finder, but it only works for known Hamiltonians which can be efficiently decomposed into Pauli operators (in some encoding). Notice that the SWAP test algorithms proposed in this paper would also work on arbitrary unitaries U, even if we just have a description in terms of the quantum circuit giving the evolution. We do not need to compute a closed form for the matrix Uor find the corresponding Hamiltonians. The application of the SWAP test for variational quantum principal analysis works on unknown input density matrices ρand has the simplest circuit from all we have seen in this paper. Two notable variational algorithms are given in [72,73], both of which follow the same philosophy of the method in Sect.5: after the procedure we have a set of classical parameters that allow the reconstruction of the desired principal component with a small error. Thealgorithm for variational quantum state diagonalizationin [72]takestwo copies of the unknown state per each quantum iteration. Both copies go through the same parametrized diagonalization circuit P( θ) and they are compared using variations of the destructive SWAP test or inner product measurements. The cost function is chosen sothat,aftersuccessful optimization,P†( θ)ρP( θ)isdiagonal. Later,thisdiagonalizing operationcanbe used to recover the eigenvaluesand eigenvectorsof ρ. The complexity is essentially the same as the circuit in Fig.6. The circuits have the same depth, but the method needs two copies of the parametrized quantum circuit and the input state instead of the one copy in Fig.6. The alternative variational quantum state eigensolver in [73] only requires one copy of ρand the parametrized circuit and, instead of the SWAP test approach, it only uses nqubits (for states in a Hilbert space of dimension 2n). This algorithm produces the same result as the method in [72] using a cost function C( θ) =tr(P†( θ)ρP( θ)H)for a given Hamiltonian Hwhich can be adapted during training. This method is more versatile and compact at the cost of adding a few gates to include the Hamiltonian in the measurement. In general, these two algorithms are more flexible than the method in Sect.5and they give a full solution to principal component analysis with a slightly higher gate 123 254 Page 18 of 24 J. C. Garcia-Escartin cost. If the full spectrum is needed they can be more interesting, but they both require more sophisticated processing and interpretation. 8 Strong and weak points, applications and outlook Classically,finding the eigenvaluesof a matrixisan efficienttask. Forunitary matrices, the QR decomposition [74–76] gives a robust algorithm with efficient and stable numerical software implementations in reference suites like the LAPACK library [77]. For an N×Nmatrix, the number of operations grows as O(N3), with alternative algorithms with complexities between quadratic and cubic depending on special cases [78–80]. This includes bisection methods that can search only for one or a limited subset of eigenvectors instead of the whole spectrum at a smaller cost in terms of the number of operations. However, in a quantum setting, the size of the state space grows exponentially in the number of qubits. For nqubits, this means that any algorithm that needs to explicitly write down the N=2ncomplex entries in a general eigenvector will suffer from this growth. The variational quantum algorithms introduced in this paper return a compressed version of the state so that we can produce the desired eigenstate on demand. The classical parameters in  θare a short list that contains all the information we need to recreate the desired eigenvector using the parametrized circuit we chose for thesearch. This nativeencoding into a quantum state allowsfor anefficient preparation for future uses. The algorithm for variational quantum principal component analysis can also be useful for channel characterization, for instance, in the analysis of mixed states coming from a quantum optical channel with decoherence or to study the decay of a quantum state with time in a noisy quantum computer. The main potential application for these methods is finding eigenvectors as a stepping stone for more complex routines. Take for instance the quantum phase estimation algorithm of Kitaev [81] where a quantum computer can give efficient approximations to an eigenvalue of a given unitary provided one of the inputs is the corresponding eigenvector. The variational quantum eigenvector finder can be used in conjunction with quantum phase estimation to obtain the full spectrum of any unitary U, including all the eigenvalues. The variational eigenvector finder also combines well with Abram and Lloyd’s algorithm that gives an efficient approximation to the eigenvectors of a Hamiltonian with arbitrary precision as long as it has a “good enough” initial guess state [82]. If we can produce a state |˜eithat approximates the desired exact eigenstate |eiand has a non-negligible overlap |˜ei|ei|2with it, the eigenstate can be refined and taken as close to the exact value as desired. This fits particularly well with the output of the variational eigenvector finder. Even if the optimization does not converge to an exact eigenvector, we can determine from P(0)−P(1)(the Zobservable from the SWAP test) whether the trial state is close or not to an eigenstate. Larger expected values correspond to a greater overlap. With the correction from Abrams–Lloyd algorithm, even poor ansätze can give a clean eigenstate. 123 Finding eigenvectors with a... Page 19 of 24 254 Fig. 8 Quantum circuit realizing the Hadamard test While these are interesting applications, both require long circuits and use the quantum Fourier transform which, for large systems, is still impractical due to accumulated noise. A more realistic application in the short term would be optimizing algorithms for noisy intermediate-scale quantum computers. Take, for instance, the Hadamard test of Fig.8, which appears in many proposals for quantum machine learning [12,83] and in the quantum algorithm for Jones polynomials [84,85]. This circuit is a simpler version of the quantum phase estimation algorithm that still can give results that no classical system can. A key element in that circuit is the controlled unitary cU which applies a unitary Uto the target when the control qubit is |1and is the identity for a control qubit |0. If we are given Uas a black box, this task is impossible in the usual quantum circuit model without describing the complete cU operator and decomposing it [86]. The total number of gates in those decompositions can be large, introducing too much noise, and there have been various attempts to give concise descriptions for particular cases in order to reduce the depth of these circuits [87–90]. In particular, if we can produce an eigenstate of the evolution there are restricted efficient circuits for cU [81]. The variational quantum eigenvector finder can be part of general methods to compute a Hadamard test with a smaller total number of gates. A preliminary simulation of the proposed quantum variational eigenvector finder [91] shows that, for moderate sizes ofU, the algorithm converges to valid eigenvectors both for random input unitaries and for defective matrices with high degeneracy like the quantum Fourier transform. As the size of the problem grows, the found state has a smaller overlap with a true eigenstate. This is a common problem in variational quantum algorithms. For an ideal algorithm, we can just use more complex parametrized circuits to cover a larger part of the state space up to a point. However, in noisy execution, this approach can be counterproductive. In the simulations, even for the smallest problems, noise introduces an appreciable deviation from true eigenstates. On this account, the proposed algorithms share the drawbacks of most hybrid variational methods. First of all, we need a good ansatz. There are different proposals for parametrized circuits that could be used. In any variational method, there is a tension between expressivity and depth. Expressivity describes how much of the whole state space can be reached from outputs of the parametrized circuit. Depth is given by the number of consecutive elementary gates we need to build the circuit. We would like to have expressive enough circuits that can generate an ansatz close to our target state (the exact eigenvector we are searching for). However, highly expressive parametrized circuits tend to have larger depths and the noise can build up to levels that make the output unusable. Apart from that, in order to sample more of the space they need more classical parameters. Optimizing a large set of parameters is less efficient and the classical part of the algorithm can converge to suboptimal solutions. Among other challenges, if we can represent very small changes, there can appear barren plateaus 123 254 Page 20 of 24 J. C. Garcia-Escartin (the optimization algorithm gets stuck in a region of the state space with small changes in the objective function but far from the real minimum) [92]. While this can limit the usefulness of the method as the state space grows, there are methods to optimize the parametric circuits so that the number of parameters is small but we are still able produce states close to the target [93,94]. The search for better parametrized circuits and optimization methods is a vibrant area of research and most of the results for other variational quantum algorithms are likely to be useful in the eigenvector algorithms. One advantage with respect to other problems, like searching for the ground state in molecular simulation, is that we do have a confirmation whether the algorithm has succeeded or not. We might not converge to a true solution, but, when we do, the expected value will be one. In general, hybrid algorithms are an interesting solution to middle sized problems, buthavechallengesscalingtoreallylargestatespaces.Theclassicaloptimizationphase becomes more involved with the number of parameters and we might not converge to the optimal solution. Even in this case, if scalable full quantum computers become available, the initial approximation the variational eigenvector finder gives can be used to kickstart the Abrams–Lloyd algorithm [82]. Despite these limitations, the presented variational eigenvector finder and quantum principal component analysis algorithms can become a useful addition to the toolbox of quantum computation in the near future and they can be incorporated into practical, more complex hybrid quantum-classical algorithms. Acknowledgements This work has been funded by the Spanish Ministerio de Ciencia e Innovación (MCIN), project PID2020-119418GB-I00 and by the European Union NextGeneration UE/MICIU/Plan de Recuperación, Transformación y Resiliencia/Junta de Castilla y León. Funding Open Access funding provided thanks to the CRUE-CSIC agreement with Springer Nature. Open Access ThisarticleislicensedunderaCreativeCommonsAttribution4.0InternationalLicense,which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. References 1. Shor, P.W.: Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM J. Comput. 26, 1484 (1997). https://doi.org/10.1137/S0097539795293172 2. Montanaro, A.: Quantum algorithms: an overview. npj Quantum Inf. 2, 1–8 (2016). https://doi.org/10. 1038/npjqi.2015.23 3. Preskill, J.: Quantum Computing in the NISQ era and beyond. Quantum 2, 79 (2018). https://doi.org/ 10.22331/q-2018-08-06-79 4. Bharti, K., Cervera-Lierta, A., Kyaw, T.H., Haug, T., Alperin-Lea, S., Anand, A., Degroote, M., Heimonen, H., Kottmann, J.S., Menke, T., Mok, W.-K., Sim, S., Kwek, L.-C., Aspuru-Guzik, A.: Noisy intermediate-scale quantum algorithms. Rev. Modern Phys. 94, 015004 (2022). https://doi.org/10. 1103/RevModPhys.94.015004 123 Finding eigenvectors with a... Page 21 of 24 254 5. McClean, J.R., Romero, J., Babbush, R., Aspuru-Guzik, A.: The theory of variational hybrid quantumclassicalalgorithms.NewJ.Phys.18, 023023(2016).https://doi.org/10.1088/1367-2630/18/2/023023 6. Endo, S., Cai, Z., Benjamin, S.C., Yuan, X.: Hybrid quantum-classical algorithms and quantum error mitigation. J. Phys. Soc. Jpn. 90, 032001 (2021). https://doi.org/10.7566/JPSJ.90.032001 7. Callison, A., Chancellor, N.: Hybrid quantum-classical algorithms in the noisy intermediate-scale quantum era and beyond. Phys. Rev. A 106, 010101 (2022). https://doi.org/10.1103/PhysRevA.106. 010101 8. McArdle, S., Endo, S., Aspuru-Guzik, A., Benjamin, S.C., Yuan, X.: Quantum computational chemistry. Rev. Mod. Phys. 92, 015003 (2020). https://doi.org/10.1103/RevModPhys.92.015003 9. Bauer, B., Bravyi, S., Motta, M., Chan, G.K.-L.: Quantum algorithms for quantum chemistry and quantum materials science. Chem. Rev. 120, 12685–12717 (2020). https://doi.org/10.1021/acs.chemrev. 9b00829 10. Tilly, J., Chen, H., Cao, S., Picozzi, D., Setia, K., Li, Y., Grant, E., Wossnig, L., Rungger, I., Booth, G.H., Tennyson, J.: The variational quantum eigensolver: A review of methods and best practices. Phys. Rep. 986, 1–128 (2022). https://doi.org/10.1016/j.physrep.2022.08.003 11. Mitarai, K., Negoro, M., Kitagawa, M., Fujii, K.: Quantum circuit learning. Phys. Rev. A 98, 032309 (2018). https://doi.org/10.1103/PhysRevA.98.032309 12. Benedetti, M., Lloyd, E., Sack, S., Fiorentini, M.: Parameterized quantum circuits as machine learning models. Quantum Sci. Technol. 4, 043001 (2019). https://doi.org/10.1088/2058-9565/ab4eb5 13. Schuld, M., Killoran, N.: Quantum machine learning in feature hilbert spaces. Phys. Rev. Lett. 122, 040504 (2019). https://doi.org/10.1103/PhysRevLett.122.040504 14. Schuld, M., Bocharov, A., Svore, K.M., Wiebe, N.: Circuit-centric quantum classifiers. Phys. Rev. A 101, 032308 (2020). https://doi.org/10.1103/PhysRevA.101.032308 15. Cerezo, M., Arrasmith, A., Babbush, R., Benjamin, S.C., Endo, S., Fujii, K., McClean, J.R., Mitarai, K., Yuan, X., Cincio, L., et al.: Variational quantum algorithms. Nat. Rev. Phys. 3, 625–644 (2021). https://doi.org/10.1038/s42254-021-00348-9 16. Buhrman, H., Cleve, R., Watrous, J., de Wolf, R.: Quantum fingerprinting. Phys. Rev. Lett. 87, 167902 (2001). https://doi.org/10.1103/PhysRevLett.87.167902 17. Barenco, A., Berthiaume, A., Deutsch, D., Ekert, A., Jozsa, R., Macchiavello, C.: Stabilization of quantum computations by symmetrization. SIAM J. Comput. 26, 1541–1557 (1997). https://doi.org/ 10.1137/S0097539796302452 18. Kobayashi, H., Matsumoto, K., Yamakami, T.: “Quantum Merlin-Arthur proof systems: are multiple Merlins more helpful to Arthur?”. In Ibaraki, T., Katoh, N. and Ono, H. editors, Algorithms and Computation. Pages 189–198. Berlin, Heidelberg (2003). Springer Berlin Heidelberg. https://doi.org/ 10.1007/978-3-540-24587-2_21 19. Juan Carlos Garcia-Escartin and Pedro Chamorro-Posada: SWAP test and Hong-Ou-Mandel effect are equivalent. Phys. Rev. A 87, 052330 (2013). https://doi.org/10.1103/PhysRevA.87.052330 20. Cincio, L., Suba¸sı, Y., Sornborger, A.T., Coles, P.J.: Learning the quantum algorithm for state overlap. New J. Phys. 20, 113022 (2018). https://doi.org/10.1088/1367-2630/aae94a 21. Warren, H.S.: “Hacker’s delight”. Addison-Wesley Professional. (2012). 2nd edition 22. Ekerå, M.: On completely factoring any integer efficiently in a single run of an order-finding algorithm. Quantum Inf. Process. 20, 1–14 (2021). https://doi.org/10.1007/s11128-021-03069-1 23. Kandala,A.,Mezzacapo,A.,Temme,K.,Takita,M.,Brink,M.,Chow,J.M.,Gambetta,J.M.:Hardwareefficient variational quantum eigensolver for small molecules and quantum magnets. Nature 549, 242–246 (2017). https://doi.org/10.1038/nature23879 24. Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., Duchesnay, E.: Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011) 25. Smith, A., Jobst, B., Green, A.G., Pollmann, F.: Crossing a topological phase transition with a quantum computer. Phys. Rev. Res. 4, L022020 (2022). https://doi.org/10.1103/PhysRevResearch.4.L022020 26. Lloyd, S.: Universal quantum simulators. Science 273, 1073–1078 (1996). https://doi.org/10.1126/ science.273.5278.1073 27. Berry,D.W.,Childs,A.M.,Cleve,R.,Kothari,R.,Somma, R.D.:Simulatinghamiltoniandynamicswith a truncated taylor series. Phys. Rev. Lett. 114, 090502 (2015). https://doi.org/10.1103/PhysRevLett. 114.090502 28. Harrow, A.W., Hassidim, A., Lloyd, S.: Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 103, 150502 (2009). https://doi.org/10.1103/PhysRevLett.103.150502 123 254 Page 22 of 24 J. C. Garcia-Escartin 29. Berry, D.W., Childs, A.M., Cleve, R., Kothari, R., Somma, R.D.: Exponential improvement in precision for simulating sparse hamiltonians. In Proceedings of the Forty-Sixth Annual ACM Symposium on Theory of Computing. Page 283–292. STOC ’14New York, NY, USA (2014). Association for Computing Machinery. https://doi.org/10.1145/2591796.2591854 30. Clinton, L., Bausch, J., Cubitt, T.: Hamiltonian simulation algorithms for near-term quantum hardware. Nat. Commun. 12, 4989 (2021). https://doi.org/10.1038/s41467-021-25196-0 31. Karl Pearson, F.R.S.: LIII. On lines and planes of closest fit to systems of points in space. London Edinburgh Dublin Philos. Mag. J. Sci. 2, 559–572 (1901). https://doi.org/10.1080/14786440109462720 32. Jolliffe, I.T., Cadima, J.: Principal component analysis: a review and recent developments. Philos. Transact. Royal Soc. A: Math. Phys. Eng. Sci. 374, 20150202 (2016). https://doi.org/10.1098/rsta. 2015.0202 33. Jolliffe, I.T.: Principal component analysis (2nd ed). Springer. (2002). https://doi.org/10.1007/b98835 34. Lloyd, S., Mohseni, M., Rebentrost, P.: Quantum principal component analysis. Nat. Phys. 10, 631–633 (2014). https://doi.org/10.1038/nphys3029 35. Tang, E.: Quantum principal component analysis only achieves an exponential speedup because of its state preparation assumptions. Phys. Rev. Lett. 127, 060503 (2021). https://doi.org/10.1103/ PhysRevLett.127.060503 36. Koczor, B.: The dominant eigenvector of a noisy quantum state. New J. Phys. 23, 123047 (2021). https://doi.org/10.1088/1367-2630/ac37ae 37. Higgott, O., Wang, D., Brierley, S.: Variational quantum computation of excited states. Quantum 3, 156 (2019). https://doi.org/10.22331/q-2019-07-01-156 38. Haus, H.A.: From classical to quantum noise. J. Opt. Soc. Am. B 12, 2019–2036 (1995). https://doi. org/10.1364/JOSAB.12.002019 39. Pozar, D.M.: Microwave engineering. Wiley. (2004). Fourth edition 40. Caianiello, E.R.: On quantum field theory – I: explicit solution of Dyson’s equation in electrodynamics without use of Feynman graphs. Il Nuovo Cimento 1943–1954(10), 1634–1652 (1953). https://doi. org/10.1007/BF02781659 41. Skaar, J., Escartín, J.C.G., Landro, H.: Quantum mechanical description of linear optics. Am. J. Phys. 72, 1385–1391 (2004). https://doi.org/10.1119/1.1775241 42. Scheel, S.: Permanents in linear optical networks (2004). arXiv:quant-ph/0406127 43. Aaronson, S., Arkhipov, A.: The computational complexity of linear optics. In Proceedings of the 43rd Annual ACM Symposium on Theory of Computing. Pages 333–342. STOC ’11New York, NY, USA (2011). ACM. https://doi.org/10.1145/1993636.1993682 44. Cerf, N.J., Adami, C., Kwiat, P.G.: Optical simulation of quantum logic. Phys. Rev. A 57, 1477–1480 (1998). https://doi.org/10.1103/PhysRevA.57.R1477 45. Reck, M., Zeilinger, A., Bernstein, H.J., Bertani, P.: Experimental realization of any discrete unitary operator. Phys. Rev. Lett. 73, 58–61 (1994). https://doi.org/10.1103/PhysRevLett.73.58 46. Bouland, A., Aaronson, S.: Generation of universal linear optics by any beam splitter. Phys. Rev. A 89, 062316 (2014). https://doi.org/10.1103/PhysRevA.89.062316 47. Sawicki, A.: Universality of beamsplitters. Quantum Inf. Comput. 16, 0291–0312 (2016). https://doi. org/10.26421/QIC16.3-4-6 48. Clements, W.R., Humphreys, P.C., Metcalf, B.J., Steven Kolthammer, W., Walmsley, I.A.: Optimal design for universal multiport interferometers. Optica 3, 1460–1465 (2016). https://doi.org/10.1364/ OPTICA.3.001460 49. de Guise, H., Di Matteo, O., Sánchez-Soto, L.L.: Simple factorization of unitary transformations. Phys. Rev. A 97, 022328 (2018). https://doi.org/10.1103/PhysRevA.97.022328 50. Bell, B.A., Walmsley, I.A.: Further compactifying linear optical unitaries. APL Photon. 6, 070804 (2021). https://doi.org/10.1063/5.0053421 51. Carolan, J., Harrold, C., Sparrow, C., Martín-López, E., Russell, N.J., Silverstone, J.W., Shadbolt, P.J., Matsuda, N., Oguma, M., Itoh, M., Marshall, G.D., Thompson, M.G., Matthews, J.C.F., Hashimoto, T., O’Brien, J.L., Laing, A.: Universal linear optics. Science 349, 711–716 (2015). https://doi.org/10. 1126/science.aab3642 52. Mennea,P.L.,Clements,W.R.,Smith,D.H.,Gates,J.C.,Metcalf,B.J.,Bannerman,R.H.S.,Burgwal,R., Renema, J.J., Steven Kolthammer, W., Walmsley, I.A., Smith, P.G.R.: Modular linear optical circuits. Optica 5, 1087–1090 (2018). https://doi.org/10.1364/OPTICA.5.001087 123 Finding eigenvectors with a... Page 23 of 24 254 53. Bogaerts, W., Pérez, D., Capmany, J., Miller, D.A.B., Poon, J., Englund, D., Morichetti, F., Melloni, A.: Programmable photonic circuits. Nature 586, 207–216 (2020). https://doi.org/10.1038/s41586- 020-2764-0 54. Elshaari, A.W., Pernice, W., Srinivasan, K., Benson, O., Zwiller, V.: Hybrid integrated quantum photonic circuits. Nat. Photon. 14, 285–298 (2020). https://doi.org/10.1038/s41566-020-0609-x 55. Arrazola, J.M., Bergholm, V., Brádler, K., Bromley, T.R., Collins, M.J., Dhand, I., Fumagalli, A., Gerrits, T., Goussev, A., Helt, L.G., et al.: Quantum circuits with many photons on a programmable nanophotonic chip. Nature 591, 54–60 (2021). https://doi.org/10.1038/s41586-021-03202-1 56. Taballione,C., van derMeer,R., Snijders,H.J., Hooijschuur,P.,Epping, J.P.,de Goede,M.,Kassenberg, B., Venderbosch, P., Toebes, C., van den Vlekkert, H., Pinkse, P.W.H., Renema, J.J.: A universal fully reconfigurable 12-mode quantum photonic processor. Mater. Quantum Technol. 1, 035002 (2021). https://doi.org/10.1088/2633-4356/ac168c 57. Hoch, F., Piacentini, S., Giordani, T., Tian, Z.-N., Iuliano, M., Esposito, C., Camillini, A., Carvacho, G., Ceccarelli, F., Spagnolo, N., Crespi, A., Sciarrino, F., Osellame, R.: Reconfigurable continuouslycoupled 3D photonic circuit for boson sampling experiments. npj Quantum Inf. 8, 1–7 (2022). https:// doi.org/10.1038/s41534-022-00568-6 58. Peruzzo,A.,McClean,J.,Shadbolt,P.,Yung,M.-H.,Zhou,X.-Q.,Love,P.J.,Aspuru-Guzik,A.,Jeremy, O.L.: A variational eigenvalue solver on a photonic quantum processor. Nat. Commun. 5, 1–7 (2014). https://doi.org/10.1038/ncomms5213 59. Schwarz, L., van Enk, S.J.: Detecting the drift of quantum sources: not the de Finetti theorem. Phys. Rev. Lett. 106, 180501 (2011). https://doi.org/10.1103/PhysRevLett.106.180501 60. Allen, L., Beijersbergen, M.W., Spreeuw, R.J.C., Woerdman, J.P.: Orbital angular momentum of light and the transformation of laguerre-gaussian laser modes. Phys. Rev. A 45, 8185–8189 (1992). https:// doi.org/10.1103/PhysRevA.45.8185 61. Allen, L., Barnett, S.M., Padgett, M.J.: Optical angular momentum. Institute of Physics Publishing, Bristol, UK. (2003). https://doi.org/10.1201/9781482269017 62. Willner, A.E., Pang, K., Song, H., Zou, K., Zhou, H.: Orbital angular momentum of light for communications. Appl. Phys. Rev. 8, 041312 (2021). https://doi.org/10.1063/5.0054885 63. Muller, A., Herzog, T., Huttner, B., Tittel, W., Zbinden, H., Gisin, N.: Plug and play’ systems for quantum cryptography. Appl. Phys. Lett. 70, 793–795 (1997). https://doi.org/10.1063/1.118224 64. Woodward,R.I.,Lo, Y.S.,Pittaluga, M.,Minder,M.,Paraïso,T.K.,Lucamarini,M., Yuan,Z.L., Shields, A.J.: Gigahertz measurement-device-independent quantum key distribution using directly modulated lasers. npj Quantum Inf. 7, 58 (2021). https://doi.org/10.1038/s41534-021-00394-2 65. Scarani, V., Bechmann-Pasquinucci, H., Cerf, N.J., Dušek, M., Lütkenhaus, N., Peev, M.: The security of practical quantum key distribution. Rev. Mod. Phys. 81, 1301–1350 (2009). https://doi.org/10.1103/ RevModPhys.81.1301 66. Feihu, X., Ma, X., Zhang, Q., Lo, H.-K., Pan, J.-W.: Secure quantum key distribution with realistic devices. Rev. Mod. Phys. 92, 025002 (2020). https://doi.org/10.1103/RevModPhys.92.025002 67. Stilck França, D., García-Patron, R.: Limitations of optimization algorithms on noisy quantum devices. Nat. Phys. 17(11), 1221–1227 (2021). https://doi.org/10.1038/s41567-021-01356-3 68. Wang, S., Fontana, E., Cerezo, M., Sharma, K., Sone, A., Cincio, L., Coles, P.J.: Noise-induced barren plateaus in variational quantum algorithms. Nat. Commun. 12(1), 6961 (2021). https://doi.org/10. 1038/s41467-021-27045-6 69. Khatri, S., LaRose, R., Poremba, A., Cincio, L., Sornborger, A.T., Coles, P.J.: Quantum-assisted quantum compiling. Quantum 3, 140 (2019). https://doi.org/10.22331/q-2019-05-13-140 70. Kokail, C., Maier, C., van Bijnen, R., Brydges, T., Joshi, M.K., Jurcevic, P., Muschik, C.A., Silvi, P., Blatt, R., Roos, C.F., Zoller, P.: Self-verifying variational quantum simulation of lattice models. Nature 569(7756), 355–360 (2019). https://doi.org/10.1038/s41586-019-1177-4 71. Kardashin, A., Uvarov, A., Yudin, D., Biamonte, J.: Certified variational quantum algorithms for eigenstate preparation. Phys. Rev. A 102, 052610 (2020). https://doi.org/10.1103/PhysRevA.102. 052610 72. LaRose, R., Tikku, A., O’Neel-Judy, É., Cincio, L., Coles, P.J.: Variational quantum state diagonalization. Quantum. npj Inform. 5(1), 57 (2019). https://doi.org/10.1038/s41534-019-0167-6 73. Cerezo, M., Sharma, K., Arrasmith, A., Coles, P.J.: Variational quantum state eigensolver. npj Quantum Inf. 8(1), 113 (2022). https://doi.org/10.1038/s41534-022-00611-6 74. Francis,J.G.F.:TheQR TransformationAUnitary AnaloguetotheLR Transformation–Part1.Comput. J. 4, 265–271 (1961). https://doi.org/10.1093/comjnl/4.3.265 123 254 Page 24 of 24 J. C. Garcia-Escartin 75. Francis, J.G.F.: The QR Transformation–Part 2. Comput. J. 4, 332–345 (1962). https://doi.org/10. 1093/comjnl/4.4.332 76. Kublanovskaya, V.N.: On some algorithms for the solution of the complete eigenvalue problem. USSR Comput. Math. Math. Phys. 1, 637–657 (1962). https://doi.org/10.1016/0041-5553(63)90168-X 77. Anderson, E., Bai, Z., Bischof, C., Blackford, S., Demmel, J., Dongarra, J., Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A., Sorensen, D.: “LAPACK users’ guide”. Society for Industrial and Applied Mathematics. Philadelphia, PA (1999). Third edition. https://doi.org/10.1137/ 1.9780898719604 78. Demmel, J.W.: “Applied numerical linear algebra”. SIAM. (1997) 79. Stewart, Gilbert W.: “Matrix algorithms: Volume II: Eigensystems”. SIAM. (2001) 80. Björck, Åke: “Numerical methods in matrix computations”. Springer. (2015). https://doi.org/10.1007/ 978-3-319-05089-8 81. Kitaev, A.: Quantum measurements and the abelian stabilizer problem (1995). arXiv:quant-ph/951102 82. Abrams, D.S., Lloyd, S.: Quantum algorithm providing exponential speed increase for finding eigenvalues and eigenvectors. Phys. Rev. Lett. 83, 5162–5165 (1999). https://doi.org/10.1103/PhysRevLett. 83.5162 83. Cao, S., Wossnig, L., Vlastakis, B., Leek, P., Grant, E.: Cost-function embedding and dataset encoding for machine learning with parametrized quantum circuits. Phys. Rev. A 101, 052309 (2020). https:// doi.org/10.1103/PhysRevA.101.052309 84. Aharonov, D., Jones, V., Landau, Z.: A polynomial quantum algorithm for approximating the Jones polynomial”. In Proceedings of the Thirty-Eighth Annual ACM Symposium on Theory of Computing. Page 427–436. STOC ’06New York, NY, USA (2006). Association for Computing Machinery. https:// doi.org/10.1145/1132516.1132579 85. Passante, G., Moussa, O., Ryan, C.A., Laflamme, R.: Experimental approximation of the Jones polynomial with one quantum bit. Phys. Rev. Lett. 103, 250501 (2009). https://doi.org/10.1103/PhysRevLett. 103.250501 86. Araújo, M., Feix, A., Costa, F., Brukner, ˇ C: Quantum circuits cannot control unknown operations. New J. Phys. 16, 093026 (2014). https://doi.org/10.1088/1367-2630/16/9/093026 87. Liu,Y.,Long,G.L.,Sun,Y.:Analyticone-bitandCNOTgateconstructionsofgeneraln-qubitcontrolled gates. Int. J. Quantum Inf. 6, 447–462 (2008). https://doi.org/10.1142/S0219749908003621C 88. Mitarai, K., Fujii, K.: Methodology for replacing indirect measurements with direct measurements. Phys.Rev.Res.1, 013006 (2019). https://doi.org/10.1103/PhysRevResearch.1.013006 89. Alonso-Linaje, G., Atchade-Adelomou, P.: EVA: a quantum exponential value approximation algorithm (2021). https://doi.org/10.48550/arXiv.2106.08731 90. Bujiao, W., Ray, M., Zhao, L., Sun, X., Rebentrost, P.: Quantum-classical algorithms for skewed linear systems with an optimized Hadamard test. Phys. Rev. A 103, 042422 (2021). https://doi.org/10.1103/ PhysRevA.103.042422 91. Garcia-Escartin, J.C.: Example code for the algorithm. https://github.tel.uva.es/juagar/QVEF (2023) 92. Holmes, Z., Sharma, K., Cerezo, M., Coles, P.J.: Connecting ansatz expressibility to gradient magnitudes and barren plateaus. PRX Quantum 3, 010313 (2022). https://doi.org/10.1103/PRXQuantum.3. 010313 93. Yuxuan, D., Zhuozhuo, T., Yuan, X., Tao, D.: Efficient measure for the expressivity of variational quantum algorithms. Phys. Rev. Lett. 128, 080506 (2022). https://doi.org/10.1103/PhysRevLett.128. 080506 94. Funcke, L., Hartung, T., Jansen, K., Kühn, S., Stornati, P.: Dimensional expressivity analysis of parametric quantum circuits. Quantum 5, 422 (2021). https://doi.org/10.22331/q-2021-03-29-422 Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. 123