{'fraction_non_alphanumeric': 0.04036938559624896, 'fraction_numerical': 0.01255110501186494, 'mean_word_length': 4.2638073739653874, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Variational Quantum Algorithms for Trace Distance and Fidelity Estimation

Estimating the difference between quantum data is crucial in quantum computing. However, as typical characterizations of quantum data similarity, the trace distance and quantum fidelity are believed to be exponentially-hard to evaluate in general. In this work, we introduce hybrid quantum-classical algorithms for these two distance measures on near-term quantum devices where no assumption of input state is required. First, we introduce the Variational Trace Distance Estimation (VTDE) algorithm. We in particular provide the technique to extract the desired spectrum information of any Hermitian matrix by local measurement. A novel variational algorithm for trace distance estimation is then derived from this technique, with the assistance of a single ancillary qubit. Notably, VTDE could avoid the barren plateau issue with logarithmic depth circuits due to a local cost function. Second, we introduce the Variational Fidelity Estimation (VFE) algorithm. We combine Uhlmann's theorem and the freedom in purification to translate the estimation task into an optimization problem over a unitary on an ancillary system with fixed purified inputs. We then provide a purification subroutine to complete the translation. Both algorithms are verified by numerical simulations and experimental implementations, exhibiting high accuracy for randomly generated mixed states.

Applications mentioned above and many other quantum information tasks suffer from unwanted interactions with the environment when implemented by real-world quantum systems, leading to errors in their working qubits. Thus, metric estimation for quantum states is vital to benchmark the tasks' implementation. As scalable quantum computers and quantum error correction are still on their way [26], estimating metric on a near-term device is essential to the verification of quantum information processing tasks and quantify how well quantum information has been preserved. Moreover, metric estimation is also an integral part of quantum machine learning [3][4][5]. For example, metrics could play the role of the loss function in state learning tasks [27,28].
The trace distance and fidelity are two typical metrics to quantify how close two quantum states are [29][30][31]. Given two quantum states ρ and σ, the trace distance D(ρ, σ) and * Electronic address: wangxin73@baidu.com the fidelity F (ρ, σ) are defined as follows: where · 1 denotes the trace norm. When at least one of the states is pure, the task of fidelity estimation reduces to the simple case of calculating the square root of the state overlap F (ρ, σ) = √ Tr ρσ which can be obtained by the Swaptest [32]. Thus the trace distance in this case is bounded by 1 − F (ρ, σ) ≤ D(ρ, σ) ≤ 1 − F (ρ, σ) 2 . However, evaluating these two metrics for mixed states is hard in general. One might attempt to classically compute the two metric from the matrix description of quantum states ρ and σ obtained via quantum state tomography. Nevertheless, this approach is infeasible due to the exponential growth of the matrix dimension with the number of qubits. On quantum computers, evaluating the trace distances is probably hard since even judging whether ρ and σ have large or small trace distance is known to be QSZK-complete [33], where QSZK (quantum statistical zero-knowledge) is a complexity class that includes BQP (bounded-error quantum polynomial time). Hence estimating fidelity and trace distance could probably be hard even for quantum computers.
Several approaches have been proposed for the trace distance and fidelity estimation, and here we focus on the case where the metric is between two unknown general quantum states. In [34], the authors variationally estimate the truncated fidelity via a hybrid classical-quantum algorithm. The truncated fidelity bounds the exact fidelity and is a good approximation of it when one of the states is known to have a low rank. For the estimation of trace distance, several methods are proposed but only applicable in specific quantum environments [35,36]. To the best of our knowledge, no methods for estimating the trace distance on general NISQ devices has been proposed yet.
To overcome these challenges, we propose the Variational Trace Distance Estimation (VTDE) algorithm as well as the Variational Fidelity Estimation (VFE) algorithm. First, we propose a method to estimate the trace norm of an arbitrary Hermitian matrix H, and apply it to trace distance estimation by specifying H = 1 2 (ρ − σ). In particular, we prove that local measurements on an ancillary single qubit can extract the desired spectrum information of any Hermitian H conjugated by a unitary. By optimizing over all unitaries, we can obtain the trace norm of H. Our method notably only employs a local observable in the loss function evaluation, which saves us from the gradient vanishing issue with shallow circuits. Second, we introduce a method to estimate the fidelity of general quantum states, which utilizes the Uhlmann's theorem. We observe that the fidelity can be estimated by optimizing over all unitaries on an ancillary system via the freedom in purification. We also introduce a subroutine that works on NISQ devices to purify quantum states. With the performance analysis of the purification subroutine, we show that only few ancillary qubits are required if the unknown states are low-rank. This paper is organized as follows. In Sec. II, we introduce the variational quantum algorithms for trace norm and trace distance estimation. In Sec. III, we introduce the variational quantum algorithms for quantum state fidelity estimation and its purification subroutine for mixed state learning. Numerical experiments and experimental implementations on IMB superconducting device are provided to show the validity of our methods. We finally deliver concluding remarks in Sec. IV.

II. VARIATIONAL TRACE DISTANCE ESTIMATION
This section introduces a variational quantum algorithm for estimating the trace norm of an arbitrary Hermitian matrix H, which could be easily applied to trace distance estimation. Our method employs the optimization of a parameterized quantum circuit (PQC), requiring only one ancillary qubit initialized in an arbitrary pure state (typically |0 0| in practice) and single-qubit measurements. In this sense, our algorithm is practical and efficient for NISQ devices.
We will frequently use symbols such as H A and H B to denote Hilbert spaces associated with quantum systems A and B, respectively. We use d A to denote the dimension of system A. The set of linear operators acting on A is denoted by L(H A ). We usually write an operator with a subscript indicating the system that the operator acts on, such as M AB , and write M A := Tr B M AB . Note that for a linear operator X ∈ L(H A ), we define |X| = √ X † X, and the trace norm of X is given by X 1 = Tr |X|.
We first formulate the theory for the trace norm estimation, then we describe in detail the process of our algorithm, followed by the numerical experiments.
and orthonormal basis {|ψ j }. Here, for technical convenience, we simply pad the spectrum with 0s to ensure the expression in Eq. (3).
Before showing the main algorithm, we introduce an optimization method to obtain some information of the spectrum of a given Hermitian matrix as follows.

Proposition 1 For any Hermitian matrix H
where H A = Tr B H AB , H AB = U H AB U † , and the optimization is over all unitaries.
This Proposition indicates that the optimization over unitaries can estimate the sum of several largest eigenvalues of H AB . The proof of Proposition 1 can be found in Appendix I A.
To apply Proposition 1 to estimate the trace norm, we fix subsystem A to be single-qubit. In this case, for arbitrary Hermitian H AB on d = 2 n -dimensional quantum system ), the maximal expectation of measurements on system A gives us the sum of the first half eigenvalues of H AB . It is now quite close to the trace norm of H AB , which is the sum of absolute values of its eigenvalues. We take the final step to estimate the trace norm by appending a 1-qubit pure state and optimizing twice. Concretely, we derive the following theorem to ensure the validity of our algorithm.
Theorem 2 For any Hermitian H A on n-qubit system A, and any single-qubit pure state |r on system R, it holds that where Q ± R = Tr A Q ± AR , Q ± AR = U ± (±H A ⊗ |r r| R )U ± † , and each optimization is over unitaries on system AR.
This theorem shows how to generally evaluate the trace norm of arbitrary H by optimization. The proof of Theorem 2 can be found in Appendix I B.
We note that, since the target Hermitian matrix is in many cases (and can always be) written as the linear combination of density matrix with real coefficients c j : we have Tr H A = j c j . Employing the information of Tr H A we can save one optimization as the following Corollary shows: Corollary 3 For any Hermitian H A (written as Eq. (6)) on nqubit system A, and any single-qubit pure state |r on system R, it holds that where Q R = Tr A Q AR , Q AR = U (H A ⊗ |r r| R )U † , and the optimization is over all unitaries on system AR.
Also in this case, max U Tr |0 0| R Q R in practice can be evaluated by post-processing: This means that we could use PQC, taking ρ j A as inputs, to perform the optimization for the trace norm estimation. In next section we will adopt this strategy to estimate the trace distance, for which H = 1 2 (ρ − σ).

B. Variational trace distance estimation algorithm
Based on corollary 3, we are now ready to show our trace distance estimation (VTDE) algorithm for arbitrary quantum states ρ and σ. Fig. 1 demonstrates the diagram of our algorithm.
Specifically, with H A = 1 2 (ρ A − σ A ) and Tr H A = 0, Eq. (7) could be written as where This observation finally enables us to estimate the trace distance by optimization over unitaries, and the algorithm is given in Algorithm 1 in detail. In our VTDE algorithm, Tr |0 0| R ρ R and Tr |0 0| R σ R are evaluated successively, then the difference between them are maximized by a classical computer. In practice, the ancillary pure state can be initially set as |r = |0 . We adopt a hardware efficient ansatz [37,38] consisting of parameterized single-qubit R y and R z rotations, along with CNOT gates on adjacent qubits as entanglement gates (also see Fig. 1) to implement the tunable unitary evolution.
Maximize the loss function L1 and update parameters θ. end for Output the optimized L1 as the trace distance estimate.
From Algorithm 1 one can tell that our VTDE estimates the trace distance for arbitrary quantum states without requiring any pre-knowledge. Furthermore, Algorithm 1 and Fig. 1 imply that VTDE employs a single-qubit ancillary qubit for any input size n of ρ and σ, and perform local (single-qubit) measurement in each iteration. In this sense, VTDE is general and efficient for NISQ devices. Recall that Algorithm 1 can be adapted to trace norm estimation for any H with decomposition H = j c j ρ j based on Corollary 3.
Given the VTDE, we briefly discuss analytic gradient and the gradient vanishing (barren plateau [39]) issues. Analytic gradient enables us to perform gradient descent to optimize the parameters. As our VTDE employs an hardware-efficient PQC, the parameter shift rule [40,41] is capable in our case to obtain analytic gradient. As for the barren plateau from which many variational quantum algorithms may suffer. We remark that our VTDE performs single-qubit measurements and takes the result as the loss function. This is essentially equivalent to a local observable, which has been proved to have at worst a polynomially vanishing gradient with a shallow PQC [42]. In this sense, our VTDE could avoid the barren plateau issue when the number of layers L ∈ O(log n).
We would like to remark that, the Naimark extension (see Example 2.2 of [43]) together with the property of trace distance that also explain VTDE. Indeed our idea is to study the capability of parameterized quantum circuits in extracting spectrum information from local measurements. Nevertheless, VTDE can be generalized for trace norm estimation of arbitrary H (Theorem 2 and Corollary 3), where trace norm estimation in Eq. (10) does not hold if we simply replace (ρ − σ) by a non-traceless H. This generalization can be lead to wider applications in quantum information like the estimation of log negativity. Our intermediate product (Proposition 1) also indicates that the partial sum of the spectrum can be extracted by local measurements.

C. Numerical experiments
Numerical experiments are undertaken to demonstrate the validity and advantage of VTDE. All simulations including optimization loops are implemented via Paddle Quantum [44] on the PaddlePaddle Deep Learning Platform [45,46].
We firstly estimate the trace distance between the 4-qubit GHZ state |ψ = 1 √ 2 (|0000 + |1111 ) and its output after the depolarizing channel: In the experiment setting, we let ρ = |ψ ψ| and σ = Dep p (ρ), where the channel parameters are p = {0.1, 0.3, 0.5, 0.7, 0.9}. For the hyper-parameters, we set ITR = 120 and learning rate LR = 0.02. Fig. 2 shows the trace distance learned by VTDE versus the numbers of iterations. As one can see, for all considered channel parameters, the trace distance between ρ and σ can be estimated accurately within feasible iterations (< 120).
Next, we explore the required number of layers of the ansatz for input states with distinct ranks. Specifically, we set the number of qubits n = 3 and Rank(σ) = 2, while Rank(ρ) ranges from 1 to 2 n = 8. We randomly sample 100 states for each number of ranks of σ, and compute the accuracy for circuits with 1, 2 and 4 layers. Here the accuracy is defined as Acc. = D est /D ide , where D est,ide are the estimated and ideal trace distances, respectively. Hyper-parameters are the same as the previous experiment. Fig. 3 summarizes the result, telling that the behavior of a 4-layer circuit is more accurate and stable, while circuits with fewer layers perform badly and unstably for any rank of ρ, possibly due to the lack in expressibility [47].

D. Implementation on superconducting quantum processor
We also apply our VTDE to estimate the trace distance between |+ state and itself affected by a dephasing channel: The result with comparison to the values achieved from simulation are listed in Table I. The experiments are performed on the IBM quantum platform, loading the quantum device ibmq quito containing 5 qubits.
The input state we choose here are ρ = |+ and σ = Deph 0.7 (ρ). On the quantum device, the input state σ is prepared by applying two Ry gates on the working and ancilla qubits with parameters π/2 and 2 arcsin √ 0.7 ≈ 1.982 respectively, followed by a Control-Z gate, then discarding the  ancilla. Next, we operate parameterized quantum circuit on qubits, and use sequential minimal optimization [48] to optimize the parameters until the cost converge to its maximum. We repeat 10 independent experiments with same input states and randomly initialized parameters. As demonstrated in Table I, the estimates converges stably for the simulator and the quantum device. Correspondingly, the achieved trace distance estimates by simulator (0.7032) is closer to the theoretical values (0.7) than that of quantum device (0.64312), which may caused by the quantum device noises.

III. VARIATIONAL FIDELITY ESTIMATION
In this section, we introduce Variational Fidelity Estimation (VFE) as a hybrid quantum-classical algorithm for estimating fidelity in the most general case where two mixed states are provided. The intuition of VFE lies in Uhlmann's theorem and the freedom in purification, based on which we prove that optimization over unitaries can obtain the fidelity. The purification of each quantum state is required by the optimization, for which we design a variational quantum state learning (VQSL) algorithm as a subroutine. Both VFE and VQSL employs PQC to implement the optimization over unitaries. We give the theory behind and the process of VFE and VQSL, respectively, followed by experimental results from a simulator and a 5-qubit IBMQ superconducting processor. The workflow of VFE is shown in Fig. 4.

A. Theory and algorithm for fidelity estimation
Suppose we have two unknown quantum states, ρ A and σ A , on system A. With arbitrary purification of ρ A and σ A (denoted by |ψ AR and |φ AR , respectively), Corollary 6 allows us to estimate the fidelity of ρ A and σ A . As the prerequisite of Corollary 6, we first introduce Uhlmann's theorem and the freedom in purification: Theorem 4 (Uhlmann's theorem, [29]) Suppose ρ and σ are states of quantum system A. Then, for given quantum purification |ψ AR of ρ A on system AR, where the maximization is over all purifications |φ AR of σ A on system AR. Then the optimization of the measurement outcome is undertaken by a classical computer (the green box). The unitary evolution on the ancillary system is realized by a hardware efficient ansatz.
Lemma 5 (Freedom in purification, [29]) For two purifications |φ 1 AR , |φ 2 AR of σ A on system AR, there exists a unitary transformation U R such that Based on the fundamental properties of quantum fidelity discussed above, we observe that the following optimization problem characterizes the fidelity function.
Corollary 6 For any quantum states ρ A and σ A on system A, and arbitrary purification |ψ AR and |φ AR of ρ A and σ A , it holds that where the optimization is over any unitaries on system R.
Corollary 6 gives us an elegant variational representation of the fidelity function that only requires purification of input states and optimization over the ancillary system. Following this line of reasoning, we design a variational quantum algorithm to estimate the fidelity of quantum states ρ and σ. We note that in Algorithm 2 the procedure of purifying ρ and σ is realized by VQSL as a subroutine, which will be presented in Sec. III B. Our method formulates the problem of directly calculating the fidelity between two mixed states into an optimization procedure over the ancillary system of two purified states. At the cost of extra subroutines, this approach could deal with arbitrary high-rank states as long as we provide enough ancillary qubits. For numerical performance analysis, we refer to Sec. III C and Sec. III D. Besides, we also derive the analytical gradient of this loss function in Appendix III, which is required for gradient-based classical optimization.
Maximize the loss function and update parameters θ; end for Output the optimized L2 as the final fidelity estimation; B. Subroutine -quantum state learning and purification The task of quantum state learning is to find the correct unitary operation such that one could prepare any target mixed state ρ from an initialized state (usually |0 0| on each qubit). In Ref. [49], the method of state learning for a pure state ρ, where Rank(ρ) = 1, is proposed. Our approach further generalizes it to work for a mixed state ρ, where Rank(ρ) ≥ 1. In order to implement our algorithm in NISQ devices, we consider quantum state learning via PQC and the framework of variational quantum algorithm (VQA). The main issue is how to design a faithful loss function L 3 to guide the learning direction. Such a loss function should be able to quantify the closeness between target ρ and prepared state χ. For pure state cases, simply maximize the state overlap Tr ρχ could help us learn the target state. But for general mixed states, this is not the case. Consider a counter example of ρ = I/2 and χ being a random one-qubit mixed state. The overlap is always Tr ρχ = 1/2 but this is clearly not the correct distance measure between ρ and χ. On the other hand, the Hilbert-Schmidt norm defined as follows could be a good candidate: As the unknown state ρ is fixed, we have where 0 < Tr ρ 2 < 1 for mixed state ρ is a constant and hence doesn't influence the optimization direction. Therefore, we choose our loss function to be Note that this loss function can be implemented on nearterm devices since the state overlap can be computed via the Swap test [50,51]. As a brief reminder, the Swap test evaluates the overlap of two arbitrary states by a single qubit measurement after a combination of Hadamard gates and controlled-swap gates. Evidence has been found that the Swap test has a simple physical implementation in quantum optics [52,53] and can be experimentally implemented on nearterm quantum hardware [54][55][56].
After discussing the general picture of state learning, we introduce its application in learning the purification of quantum state ρ A on system A. This can be done by providing an ancillary qubit system R with dimension d R and initializing the complete system with |χ 0 = |00 AR . Then we apply a parametrized unitary operation U AR (θ) to drive the system and use classical optimization methods to minimize Eq. (18). In the case of learning purification, we need to set where the symbol Tr R denotes the partial trace operation with respect to the ancillary system R. With the above set up, we introduce a variational quantum algorithm to learn the purification of a quantum state ρ A as follows.
Initialize parameters θ. for itr = 1, . . . , ITR do Apply UAR(θ) to three equivalent initial states |χ0 on system AR and obtain the resulting partial states: Perform optimization for L3(θ) and update parameters θ; end for Output the final purified state |ψ AR = UAR(θ * )|00 AR; We want to emphasize that the scope of state learning is much broader than the purification learning task. One could further develop this approach for quantum state preparation and many other applications. For our purpose, learning a purified state to estimate the fidelity is enough. At the cost of introducing ancillary qubits, one could prepare a purification |ψ AR of target mixed state ρ A with high fidelity. Then, it will be important to study the performance of VQSL with different ancillary dimensions d R . The following analysis suggests that only a few ancillary qubits are necessary for low-rank states.
For best performance, one should choose the dimension of the ancillary system to be the same as the original system A such that d R = d A .
Proposition 7 Suppose the input state ρ A has the spectral decomposition ρ A = k j=1 λ j |ψ j ψ j | with decreasing spectrum {λ j } k j=1 . There exists a quantum circuit U AR that generates χ A from |00 AR to approximate the target state ρ A with a fidelity that satisfies where the second case is at least d R /k.
where χ A = Tr R U AR |00 00| AR U † AR is the reduced state on the subsystem A. For convenience, denote the state U AR |00 AR by |ψ and hence Since the Schmidt rank of |ψ is at most d R , the rank of χ A is also at most d R .
If k ≤ d R , one could choose unitary U AR such that |ψ = U AR |00 AR = k j=1 λ j |ψ j A |ϕ j R , where {|ψ j A } and {|ϕ j R } are orthonormal state sets. This ensures that χ A = Tr R |ψ ψ| = j λ j |ψ j ψ j | = ρ A and leads to a fidelity F (ρ A , χ A ) = 1. On the other hand, if k > d R , there exists an unitary U such that |ψ = U AR |00 AR = d R j=1 ξ j |ψ j A |ϕ j R . In particular, one could further choose ξ j = λj η for j = 1, · · · , d R , where the denominator is defined as η = d R =1 λ . Then, one can calculate the fidelity F as

C. Numerical experiments and Trainability
In this section, we conduct simulations to investigate the performance of VFE for state fidelity estimation and its subroutine VQSL for purification learning. The parametrized quantum circuit U AR (θ) used for Algorithm 3 VQSL and U R (θ) for Algorithm 2 are recorded in Appendix IV. All simulations including optimization loops are implemented via Paddle Quantum [44] on the PaddlePaddle Deep Learning Platform [45,46].
We firstly generate 10 random pairs of full-rank density matrices {ρ A | · · · |ρ (10) A , σ (10) A } for n A = {1, 2, 3} qubits and calculate the deviation ∆F between the target fidelity and estimated fidelity. We choose d R = d A for best performance in purification learning. The results are summarized in Table. II. The average error rate can be reduced to the level of < 0.5%. The maximum average error E max [∆F ] ≈ 0.2476% happens at n A = 2, and no clear scaling phenomenon of average error is observed.   [57] is adopted and hyper-parameters are taken to be depth L = 6, learning rate LR = 0.2, and iteration loops ITR = 100 (the latter two hyper-parameters are same for VFE). Next, we conduct simulations to qualitatively study the influence of limited ancillary qubits given high-rank states k > d R . 3 random pairs of density matrices, {ρ A }, are prepared with Rank= {2, 4, 8} respectively. Then, we test the performance of VFE with different number of ancillary qubits n R = {1, 2, 3}. The results are summarized in Fig.5. By providing enough ancilla qubits, VFE could estimate the fidelity between two arbitrary full rank mixed states. If not, the purification subroutine will be restricted to produce pure states with fidelity bounded by Eq. (20), which is consistent with the numerical simulation. This scalability requirement offers the flexibility of providing few ancilla qubits for low-rank states but can bring challenges when accurately evaluating the fidelity between two high-rank quantum state in large dimensions.
Here we discuss the trainability issues for VFE and possible solutions. With an extended system dimension introduced by the purification, VFE might exhibit a barren plateau [39] due to a global loss function. This would result an exponentially suppressed gradient with respect to the problem dimension, a phenomenon known as the barren plateau (BP). Ref. [58] shows BP is independent of the optimization methods, meaning that simply change into a gradient-free optimizer would not help. In order to mitigate this trainability issue, several approaches have been proposed such as the parameter initialization and correlation strategies [59,60], layer-wise learning [61], and variable structure ansatzes [62][63][64]. We leave the adaptation of these strategies to VFE for future study.

D. Implementation on superconducting quantum processor
We also apply our VFE to estimate the fidelity between states which are |+ states affected by dephasing channel Deph p with different intensity p. The result with comparison to the values achieved from simulation are listed in Table III. The experiments are performed on the IBM quantum platform, loading the quantum device ibmq quito containing 5 qubits. The input state we choose here are ρ = Deph p1 (|+ ) and σ = Deph p2 (|+ ), where p 1 = 0.2 and p 2 = 0.9. On the quantum device, the input states are prepared similarly to the preparation in Sec. II D and we keep the ancilla as a perification. Next, we operate parameterized quantum circuit on the ancilla, and use sequential minimal optimization [48] to optimize the parameters until the loss function converges to its maximum. We repeat 10 independent experiments with same input states and randomly initialized parameters. As demonstrated in Table III, the estimated fidelity from our method are close to the ideal value with stable performance due to a very small variance.

IV. CONCLUSION AND OUTLOOK
In this work, we have introduced near-term quantum algorithms VTDE and VFE to estimate trace distance and quantum fidelity. A strength of our algorithms is that they estimate the metrics directly rather than estimating their bounds. Our algorithms also do not require any assumption on the unknown input states. These algorithms are executable on near-term quantum devices equipped with parameterized quantum circuits. In particular, VTDE could be easily generalized for trace norm estimation for any Hermitian matrix and could avoid the barren plateau issue with logarithmic depth parameterized circuits.
Beyond benchmarking the quantum algorithms' behavior, our VTDE and VFE could have a wide range of applications in quantum information processing. A direct extension of VTDE might be the estimation for the diamond norm [65][66][67], which is a widely-used distance measure for quantum channels. The trace distance can also be applied to quantify the Bell nonlocality [68], quantum entanglement [69], and the security of quantum cryptography protocols [70], where VTDE could be utilized as a practical subroutine. VFE may be applied to evaluate the conditional quantum mutual information of tripartite quantum states [71]. It is also of great interest to have a further study on the estimation of sandwiched/Geometric Rényi relative entropies [72][73][74] as an extension of VFE. Efficient estimations of these distance measures could be used to further evaluate the resource measures of entanglement, coherence, magic and other resources in quantum information [75][76][77][78][79][80][81][82][83][84][85].
where H A = Tr B H AB , H AB = U H AB U † , and the optimization is over all unitaries.
Proof By the definition of partial trace, we have As the equality of Eq. S3 holds when H AB is diagonolized under the computational basis, the proof is complete.

B. Proof of Theorem 2
Theorem 2 For any Hermitian H A on n-qubit system A, and any single-qubit pure state |r on system R, it holds that where Q ± R = Tr A Q ± AR , Q ± AR = U ± (±H A ⊗ |r r| R )U ± † , and each optimization is over unitaries on system AR. Proof The main idea of the proof of Theorem 2 is to show that the two maximization item approximates the sum of the positive and negative eigenvalues of H A respectively. Note that the trace norm H A 1 equals to the sum of the absolute values of H A 's eigenvalues: Observe that H A and H A ⊗ |r r| R have the same spectrum, up to d A 0 eigenvalues. Denote the decreasing spectrum of H A ⊗ |r r| R by {h j AR } 2d A j=1 . Then this observation implies that According to Proposition 1, for Q + AR = U + (H A ⊗ |r r| R )U + † , max U + Tr |r r| R Q + R equals to the sum of the first half eigenvalues of H A ⊗ |r r| R , therefore to the sum of the first half eigenvalues of −H A ⊗ |r r| R , or to say, the sum of the absolute value of the last half eigenvalues of H A ⊗ |r r| R : Together with Eq. (S5), (S7), and (S8) we have which completes the proof.

II. A NAIVE ALGORITHM FOR TRACE DISTANCE ESTIMATION
From the definition of trace norm, one may naturally try to learn H 1 by twice optimizing over projectors. Explicitly, we have the following proposition: Proposition S1 The trace norm H 1 can be obtained by: where each optimization is over projectors. The optimized projector P ± is rank-k ± , where k ± is the number of the positive/negative eigenvalues of H.
Proof Consider the spectrum decomposition of H: and S and T are positive and orthogonal. In this sense, we have Tr(P + H) = Tr(P + (S − T )) ≤ Tr(P + S) ≤ Tr S Tr(−P − H) = Tr(P − (T − S)) ≤ Tr(P − T ) ≤ Tr T (S13) The two inequalities become equal when P ± is the projector onto the support of S and T , respectively. Thus the optimized projectors P ± is rank-k ± , where k ± is the rank of S/T , i. e., the number of the positive/negative eigenvalues of H. Eq. S12 and Eq. S13 imply Eq. S10, which finish the proof.
Using similar technique in the proof of Corollary 3 we can have following corollary on trace distance estimation from Proposition S1.
Corollary S2 For any quantum states ρ and σ, it holds that D(ρ, σ) = max P Tr P (ρ − σ), (S14) and the optimized projector P is rank-k, where k is the number of the positive eigenvalues of ρ − σ.
In practice, any rank-k projector can be characterized by and one can obtain Tr P rank−k H = k j=1 Tr HU |j j|U † . If one does not have k as prior knowledge of ρ, σ, one has to try different k until max U Tr P rank−k (ρ−σ) reaches a maximum with respect to k. Then one have the following intuitive (but somehow naive) algorithm for trace distance estimation:
for k = 1, . . . , 2 n − 1 do Initialize parameters θ. for itr = 1, . . . , ITR do Prepare k quantum states |j , j ∈ [1, k]; Apply U (θ) respectively to all |j , and obtain L k 4 = k j=1 (Tr U ρU † |j j| − Tr U σU † |j j|); Maximize the loss function L k 4 and update parameters of θ; end for if max θ L k 4 (θ) does not increase with k then break end if end for Output L4 as the trace distance estimation; Algorithm 4, though requires no ancillary qubit, is inefficient for a large k. From the perspective of quantum resources, Algorithm 4 needs at least k computational basis quantum states. From the perspective of time, Algorithm 4 also needs k rounds of optimization. In the worst case, k = 2 n − 1.
We remark that, if one of the two unknown states is pure (suppose ρ is the pure state), then ρ − σ has at most one positive eigenvalue. Explicitly, we have the following lemma: Lemma S3 If ρ is a pure state and σ is an arbitrary state, then ρ − σ has at most one positive eigenvalue.
Proof According to the Weyl's inequality in matrix theory (see [87]), for Hermitian matrices A, B, C = A + B , we have where a j , b j and c j are the j−th largest eigenvalue of A, B and C, respectively, and d is the dimension. Let k = d = 2 n , A = ρ − σ, B = σ and use the second inequality: We use the fact that σ is positive (which implies b d ≥ 0), and Rank(ρ) = 1 (which implies c j = 0 for j ≥ 2). Finally we have a j ≤ 0, ∀j ≥ 2, (S18) which complete the proof that ρ − σ has at most one positive eigenvalue. The above lemma can also be proved if we consider whether the support of ρ is in the support of σ and analyze each case separately.
Thus, if one of the two states is pure, we only have to prepare one rank-1 projector |0 0|. Fig. 6 shows the behavior of VTDE and nVTDE for ρ − σ with different number of positive eigenvalues. In the n = 4 case, the number of positive eigenvalues can range from 1 to 2 4 − 1. Fig. 6 shows that the performance of VTDE is stable with different numbers of positive eigenvalues, while the performance of nVTDE relies heavily on the difference between k and the number of positive eigenvalues, as analyzed above. . The curves show that the performance of VTDE is stable with different numbers of positive eigenvalues. In contrast, the performance of nVTDE relies heavily on the difference between k and the number of positive eigenvalues.

IV. QUANTUM CIRCUIT FOR VFE
There are two types of parametrized quantum circuit used in VFE. The first type U R (θ) only acts on the ancillary system and aims at fulfilling Algorithm 2. In this specific study, it is taken to be the U 3 rotation gate on Bloch sphere, 2-qubit universal gate [88], and 3-qubit universal gate [89] for n A = {1, 2, 3} respectively. The second type serves for Algorithm 3 purification learning and is shown in Fig. 7. Each block consists of a column of general U3(θ, φ, ϕ) = Rz(φ)Ry(θ)Rz(ϕ) rotations for each qubit, followed with a circular layer of CNOT gates. Notice that the number of parameters in this ansatz increases linearly with the circuit depth L and the number of qubits.