Introduction

Quantum coherence and entanglement are two basic concepts in quantum information theory, which are extensively applied to quantum information processing and quantum computational tasks1. Moreover, both quantum coherence and entanglement can be regarded as quantum resources, and they are useful for quantum-enhanced metrology, quantum key distribution and so on2,3,4,5,6,7,8. Therefore, characterizing and quantifying coherence and entanglement become significant parts in quantum information theory9.

Quantum coherence is defined for a single system, and is widely used in quantum optics in previous studies10,11,12,13,14,15,16,17. For any distance measure D between two arbitrary quantum states, a general coherence measure is defined as \(C_{D}(\rho )=\min _{\delta \in {\mathbb {I}}}D(\rho ,\delta )\), i.e., the minimum distance from \(\rho\) to all possible incoherent states \(\delta \in {\mathbb {I}}\), where \({\mathbb {I}}\) is the set of all incoherent states18,19,20,21,22. From this definition, one can see that \(C_{D}(\rho )=0\) if and only if \(\rho\) is an incoherent state. Many distance-based coherence measures are proposed, such as geometric measure of coherence, relative entropy of coherence and \(l_{p}\) norm of coherence. The geometric measure of coherence is defined by using the fidelity between the measured state \(\rho\) and its nearest incoherent state23. The relative entropy of coherence is another distance-based coherence measure18,24,25. Considering the coherence measures based on the matrix norms, the \(l_{1}\) norm of coherence was introduced and studied in Ref.18. Besides, other different coherence measures have also been proposed25,26,27,28. Furthermore, many experimental results on coherence have been reported29,30,31,32,33.

Quantum entanglement is widely regarded as an essential feature of quantum mechanics, and entanglement measures have many applications34,35,36,37. A class of entanglement measures are based on the fact that the closer a state is to the set \({\mathbb {S}}\) of separable states, the less entanglement it has19,22. According to the distance measure D between quantum states \(\rho\) and \(\sigma\), it is defined as \(E_{D}(\rho )=\min _{\sigma \in {\mathbb {S}}}D(\rho ,\sigma )\), i.e., the measure is the minimum distance to all possible separable states18,19,20,21,22. One fundamental distance-based entanglement measure is the relative entropy of entanglement22, which can be considered as a strong upper bound for entanglement of distillation38. Another one is the geometric measure of entanglement (GME)9,39,40. Furthermore, the expected value of entanglement witnesses can be used to estimate the GME41,42,43. Other different entanglement measures have been proposed for multipartite systems and mixed states19,20.

For most quantum states, the analytical solutions of the coherence and entanglement measures are not available, so numerical algorithms must be applied. In some entanglement measures, several numerical algorithms have been used to solve related problems44,45,46,47. Moreover, computing many entanglement measures is NP hard for a general state48,49, so some upper and lower bounds are proposed to describe entanglement50,51,52,53,54,55,56,57 and coherence measures8,58,59,60,61. In Refs.62,63, a semidefinite program (SDP) was proposed to calculate the fidelity between two states, which inspire us to apply this semidefinite program to numerically obtain the geometric measures of coherence and entanglement. In the following, we will try to provide semidefinite programs, in order to get the numerical results of the geometric measures of coherence and entanglement.

In this work, we first review the definition and properties of fidelity and its semidefinite program. Then we present numerical and analytical results for the geometric measure of coherence. Our algorithm can be used to numerically obtain the geometric measure of coherence for arbitrary finite-dimensional states. We test our semidefinite program for single-qubit states, single-qutrit states, and a special kind of d-dimensional mixed states. For the special kind of d-dimensional mixed states, we also obtain an analytical solution of its geometric measure of coherence. Furthermore, we also propose another algorithm for the geometric measure of entanglement, which can obtain the geometric measure of entanglement for arbitrary two-qubit and qubit-qutrit states, and some special kinds of higher dimensional mixed states. For other states, a lower bound of the geometric measure of entanglement can be acquired by using the algorithm.

Results

A semidefinite program for computing fidelity

We first review the fidelity and its semidefinite program in the following. The fidelity between states \(\rho\) and \(\chi\) is defined as1

$$\begin{aligned} F(\rho ,\chi )\equiv \mathrm{Tr}{\sqrt{\rho ^{\frac{1}{2}} \chi \rho ^{\frac{1}{2}}}}. \end{aligned}$$
(1)

For a pure state \(|\psi \rangle\) and an arbitrary state \(\chi\), one can get that

$$\begin{aligned} \begin{aligned} F(|\psi \rangle ,\chi )=\sqrt{\langle \psi |\chi |\psi \rangle }. \end{aligned} \end{aligned}$$
(2)

In Refs.62,63, Watrous and colleagues proposed a semidefinite program, whose optimal value equals the fidelity for given positive semidefinite operators, i.e., considering the following optimization problem

$$\begin{aligned} \mathrm {maximize}: \quad&\frac{1}{2} \mathrm{Tr}(X)+ \frac{1}{2} \mathrm{Tr}(X^\dagger ),\nonumber \\ \mathrm {subject \ to} :\quad&\left( \begin{matrix} \rho &{} X \\ X^\dagger &{} \chi \\ \end{matrix}\right) \ge 0, \nonumber \\&X\in L({\mathbb {X}}), \nonumber \\&\rho ,\chi \in Pos({\mathbb {X}}), \end{aligned}$$
(3)

where L is the collection of all linear mappings. In a \({\mathbb {X}}\) complex Hilbert space, \(Pos({\mathbb {X}})\) is the set of positive semidefinite operators operating on \({\mathbb {X}}\). Then the maximum value of \(\frac{1}{2} \mathrm{Tr}(X)+ \frac{1}{2} \mathrm{Tr}(X^\dagger )\) is equal to \(F(\rho ,\chi )\). X is a randomly generated complex matrix of the same order as \(\chi\).

The SDP can not only solve the problem effectively, but also prove the global optimality under weak conditions64. This implies that SDP optimization problems can be tackled with standard numerical packages. In this paper, the optimization of the SDP (3) can be solved by using the Matlab parser YALMIP65 with the solvers, SEDUMI66 or SDPT367,68. In fact, there exist serval SDP problems in quantum information theory. For example, SDP programs have been used in entanglement detection and quantification69,70,71,72,73,74, quantifying quantum resources75. Furthermore, the SDP (3) has also been used for calculating the fidelity of quantum channels76.

Geometric measures of coherence

In a d-dimension Hilbert space \({\mathcal {H}}\) with its corresponding reference basis \(\{|i\rangle \}_{i = 0}^{d-1}\), a state is incoherent if and only if it is a diagonal density matrix under the reference basis2,3. All incoherent states can be represented as2,3

$$\begin{aligned} \delta = \sum _{i=0}^{d-1} p_i|i\rangle \langle i|. \end{aligned}$$
(4)

Thus, the geometric measure of coherence is defined as23

$$\begin{aligned} C_{g}(\rho )=1-\left[ \max _{\delta \in {\mathbb {I}}}F(\rho ,\delta )\right] ^2, \end{aligned}$$
(5)

with the maximum being taken over all possible incoherent states \(\delta \in {\mathbb {I}}\). Based on the SDP (3), Eqs. (4) and (5), we provide the MATLAB code for the semidefinite program of geometric measure of coherence in Supplemental Material 1.

For an arbitrary single-qubit state \(\rho\), its analytical solutions of \(C_{g}(\rho )\) has been derived23

$$\begin{aligned} C_{g}(\rho )=\frac{1}{2}\left( 1-\sqrt{1-4|\rho _{01}|^2}\right) , \end{aligned}$$
(6)

where \(\rho _{01}\) is the off-diagonal element of \(\rho\) in reference basis. To compare with this analytical solution, we randomly generate \(10^5\) density matrices and calculate their \(C_{g}(\rho )\) by analytical and numerical methods, respectively. The analytical results are calculated based on Eq. (6), and the numerical results are obtained by optimizing the semidefinite program77. The maximum deviation between the analytical and numerical results is \(3.19 \times 10^{-9}\).

For a pure state \(|\psi \rangle =\sum _i \lambda _i |i\rangle\), its geometric measure of coherence is

$$\begin{aligned} C_{g}(|\psi \rangle )=1-\max _{i}\{|\lambda _i|^2\}, \end{aligned}$$
(7)

where \(|\lambda _i|^2\) is the diagonal elements of \(|\psi \rangle \langle \psi |\)3. However, the corresponding analytical solutions of \(C_{g}(\rho )\) are difficult to calculate for general mixed states, so it is necessary to get some lower and upper bounds of \(C_{g}(\rho )\). Here we employ the lower and upper bounds proposed in Ref.59 and compare them with our numerical results of the optimization program. For a general \(d\times d\) density matrix \(\rho\), its \(C_{g}(\rho )\) satisfies59

$$\begin{aligned} 1-\frac{1}{d}-\frac{d-1}{d}\sqrt{1-\frac{d}{d-1}(\mathrm{Tr}{\rho ^2}-\sum _{i}{\rho _{ii}^2})} \le C_{g}(\rho ) \le \min \left\{ 1-\max _{i}\{\rho _{ii}\},1-\sum _{i}{b_{ii}^2} \right\} , \end{aligned}$$
(8)

where \(b_{ii}\) is from \(\sqrt{\rho }=\sum _{ij}b_{ij}{|i\rangle \langle j|}\).

Since there is no corresponding analytic solution for general single-qutrit mixed states, we randomly generate \(10^5\) density matrices to draw their corresponding upper and lower bounds. In Fig. 1, there is a clear dividing line between two bounds indicating that the numerical results obtained by our algorithm coincide with the analytical results from the inequality (8), and points on the upper bound is closer to the dividing line than points on the lower bound for many \(3\times 3\) density matrices.

Figure 1
figure 1

Black points (Red points) represent the left (right) hand side of the inequality (8). \(C_{g}(\rho )\) indicates our numerical results. There is apparent dividing line between them.

Now we consider the following mixed state

$$\begin{aligned} \rho =p |\psi ^+\rangle \langle \psi ^+|+(1-p)\frac{\mathrm {I}}{d}, \end{aligned}$$
(9)

with \(|\psi ^+\rangle =\frac{1}{\sqrt{d}}\sum _{i=0}^{d-1}|i\rangle\), \(\mathrm {I}\) being the \(d\times d\) identity matrix, and \(0\le p \le 1\). Since the mixed state \(\rho\) is highly symmetric, it will remain unchanged when we exchange its basis order. It limits that the reference incoherent state in geometric measure of coherence must have the same diagonal elements, i.e., the closest incoherent state \(\delta\) to the density matrix \(\rho\) has to be

$$\begin{aligned} \delta =\sum _{i=0}^{d-1}\frac{1}{d}|i\rangle \langle i|. \end{aligned}$$
(10)

Therefore, we can obtain its analytical solution of geometric measure of coherence.

Proposition 1

For the mixed state \(\rho =p |\psi ^+\rangle \langle \psi ^+|+(1-p)\frac{\mathrm {I}}{d}\) with \(|\psi ^+\rangle =\frac{1}{\sqrt{d}}\sum _{i=0}^{d-1}|i\rangle\), its analytical solution of geometric measure of coherence is

$$\begin{aligned} C_{g}(\rho )=1-\frac{1}{d^2}[(d-1)\sqrt{1-p}+\sqrt{1+(d-1)p}]^2. \end{aligned}$$
(11)

This analytical result is equal to its corresponding upper bound which is the right hand side of the inequality (8). When \(2\le d \le 20\), we calculate their analytical and numerical results as well as maximum deviation between them. For \(d=3\) the corresponding graph is drawn and the rest have the similar phenomena like it. In Fig. 2, \(C_{g}(\rho )\) and its upper bound coincide for \(d=3\), and the maximum deviation between them is \(1.51\times 10^{-9}\). In Fig. 3, the maximum deviation between the numerical and analytical results is about \(10^{-9}\) orders of magnitude. Although the average time \(\overset{\sim }{t} (s)\) of each operation increases exponentially, it is within an acceptable range in the low dimensional case.

Figure 2
figure 2

The black line (blue dots) indicates the left (right) hand side of the inequality (8). The red dashed line \(C_{g}(\rho )\) from Eq. (11) is coincident with the upper bound for \(d=3\).

Figure 3
figure 3

The red line represents the maximum deviation between the numerical solution and the analytical solution. The blue line indicates the average time \(\overset{\sim }{t} (s)\) of each operation for the density matrices (9).

Geometric measures of entanglement

A separable bipartite pure state can be written in the following product form

$$\begin{aligned} |\psi ^{AB} \rangle =|\psi ^{A} \rangle \otimes |\psi ^{B} \rangle . \end{aligned}$$
(12)

For mixed states, if it can be represented as convex weights \(p_{i}\) and product states \(\rho _{i}^{A}\otimes \rho _{i}^{B}\)78

$$\begin{aligned} \rho ^{AB}=\sum _{i}p_{i}\rho _{i}^{A}\otimes \rho _{i}^{B}, \end{aligned}$$
(13)

then \(\rho ^{AB}\) is separable. For a bipartite state, if there is no negative eigenvalues after the partial transposition of subsystem A, this bipartite state is called the PPT states79, i.e., a bipartite state

$$\begin{aligned} \rho _{A|B}=\sum _{ij,kl} \rho _{ij,kl} |i\rangle \langle j|_{A} \otimes |k\rangle \langle l|_{B}, \end{aligned}$$
(14)

is PPT, when its partial transposition with respect to the subsystem A satisfys

$$\begin{aligned} \rho _{A|B}^{T_{A}}=\sum _{ij,kl} \rho _{ij,kl}|j\rangle \langle i|_{A} \otimes |k \rangle \langle l|_{B} \ge 0. \end{aligned}$$
(15)

The GME is defined as follows80

$$\begin{aligned} E_{G}(\rho )=1-\left[ \max _{\sigma \in {\mathbb {S}}}F(\rho ,\sigma )\right] ^2, \end{aligned}$$
(16)

where \({\mathbb {S}}\) is the set of all separable states. We replace \({\mathbb {S}}\) with the set \({\mathbb {P}}\) of all PPT states, because \({\mathbb {S}}\) cannot be easily expressed in the semidefinite programs, but \({\mathbb {P}}\) can be expressed since for a given density matrix one can directly calculate its partial transpose41. Thus, based on the fact that \({\mathbb {S}}\) is a subset of \({\mathbb {P}}\)79, one can obtain a lower bound of \(E_{G}(\rho )\), i.e.,

$$\begin{aligned} E_{G}(\rho )\ge \overset{\sim }{E}_{G}(\rho ), \end{aligned}$$
(17)

where the lower bound \(\overset{\sim }{E}_{G}(\rho )\) is defined by

$$\begin{aligned} \overset{\sim }{E}_{G}(\rho )=1-\left[ \max _{{\tilde{\sigma }}\in {\mathbb {P}}} F(\rho ,{\tilde{\sigma }})\right] ^2. \end{aligned}$$
(18)

The equality in Eq. (17) holds for all two-qubit and qubit-qutrit states81, and some special kinds of higher dimensional mixed states. Based on the SDP (3), Eqs. (15) and (16), we provide the MATLAB code for the semidefinite program of \(\overset{\sim }{E}_{G}(\rho )\) in Supplemental Material 1.

For pure states, the GME is defined as9

$$\begin{aligned} E_{G}(|\psi \rangle )=1-\max _{|\phi \rangle \in {\mathbb {S}}}|\langle \psi |\phi \rangle |^2, \end{aligned}$$
(19)

Moreover, it is defined via the convex roof construction for mixed states. If \(\rho\) is a two-qubit state, the corresponding expression of \(E_{G}(\rho )\) is9,82,83

$$\begin{aligned} E_{G}(\rho )=\frac{1}{2} \left( 1-\sqrt{1-C(\rho )^2}\right) . \end{aligned}$$
(20)

The \(C(\rho )\) is called concurrence that its expression is

$$\begin{aligned} C(\rho )=\max {\{0,\lambda _{1}-\lambda _{2}-\lambda _{3}-\lambda _{4}\}}, \end{aligned}$$
(21)

where \(\{\lambda _{i}\}\) are the square root of eigenvalues of \(\rho \overset{\sim }{\rho }\) in descending order and \(\overset{\sim }{\rho }=(\sigma _{y}\otimes \sigma _{y})\rho ^*(\sigma _{y}\otimes \sigma _{y})\). In order to compare the analytical result Eq. (20) and the numerical result for two-qubit states, we randomly generate \(10^5\) density matrices and calculate the analytical and numerical results respectively. The maximum difference between them is \(1.57 \times 10^{-9}\).

Table 1 The maximum deviation between the numerical solution and the analytical solution with \(\Delta E_{G}(\rho )=E_{G}(\rho )- \overset{\sim }{E}_{G}(\rho )\), and the average time \(\overset{\sim }{t} (s)\) of each operation for the isotropic states (22).

Now we apply our semidefinite program to the isotropic states, where the forms of these states are9

$$\begin{aligned} \rho =\frac{1-F}{d^2-1}(\mathrm {I}-|\Phi ^{+}\rangle \langle \Phi ^{+}|)+F|\Phi ^{+}\rangle \langle \Phi ^{+}|, \end{aligned}$$
(22)

with the maximally entangled state \(|\Phi ^{+}\rangle =\frac{1}{\sqrt{d}}\sum _{i=0}^{d-1}|ii\rangle\) and \(0\le F\le 1\). The analytical solutions for the GME of these isotropic states were given in Ref.9, and the states are separable if and only if \(F \le \frac{1}{d}\)84. For Eq. (22) when \(2 \le d \le 5\), we calculate that the maximum deviation between the numerical and analytical solution by our semidefinite program and the analytical solution given in9, respectively. The results are summarized in Table 1, where \(\overset{\sim }{t} (s)\) denotes the average time of each operation. In the example tested above, the semidefinite program always obtain the same value as \(E_{G}(\rho )\) within the precision given in Table 1.

Table 2 The maximum deviation between the numerical solution and the analytical solution with \(\Delta E_{G}(\rho )=E_{G}(\rho )- \overset{\sim }{E}_{G}(\rho )\), and the average time \(\overset{\sim }{t} (s)\) of each operation for the Werner states (23).

Finally, we apply semidefinite program to the Werner states that it can be expressed as a linear combination of two operators of the identity \({\mathrm {I}}\) and the swap \({\hat{F}}\equiv \sum _{ij} |ij\rangle \langle ji|\)9, i.e., \(\rho =a \mathrm {I}+{b {\hat{F}}}\), where a and b are both real coefficients and are limited by \(\mathrm{Tr}{\rho }=1\). When one of the parameters is considered, the states can be expressed as

$$\begin{aligned} \rho =\frac{d^2-fd}{d^4-d^2}\mathrm {I}\otimes \mathrm {I}+{\frac{fd^2-d}{d^4-d^2}} {\hat{F}}, \end{aligned}$$
(23)

with \(f\equiv {\mathrm{Tr}}(\rho {\hat{F}})\). The corresponding analytic solution for the Werner states (23) is9

$$\begin{aligned} E_{G}(\rho )=\frac{1}{2}\left( 1-\sqrt{1-f^2}\right) , \end{aligned}$$
(24)

for \(f \le 0\) or 0 otherwise. For \(2 \le d \le 5\), we apply our semidefinite program to states (23), so the maximum deviation between the numerical solution and the analytical solution is calculated, respectively. The results are summarized in Table 2, where \(\overset{\sim }{t} (s)\) is the average time of each operation.

Discussion

For the geometric measure of entanglement, we compare our algorithm with the algorithm proposed in Ref.47. Streltsov and colleagues proposed an algorithm47, which can be easily implemented by solving an eigenproblem or finding a singular value decomposition of a matrix. However, their algorithm needs the iteration with many steps, and it may converge to a local minimum which is not the exact value of the geometric measure of entanglement. Our algorithm, which does not need iteration and has no local minimum problems, is based on semidefinite program and easy to implement. Unfortunately, the shortcoming of our algorithm is also obvious. It can be used to calculate the geometric measure of entanglement for arbitrary two-qubit and qubit-qutrit states, and some special kinds of higher dimensional mixed states. But for other states, our algorithm can only get a lower bound of the geometric measure of entanglement.

In this paper, we introduced numerical and analytical results to compute the geometric measures of coherence and the entanglement. In coherence measures, the deviation between the numerical solution and the analytical solution was an order of magnitude of \(10^{-9}\) for single-qubit states. Furthermore, we obtained the analytical solution of the geometric measure of coherence \(C_{g}(\rho )=1-\frac{1}{d^2}[(d-1)\sqrt{1-p}+\sqrt{1+(d-1)p}]^2\) for the special kind of mixed states \(\rho =p |\psi ^+\rangle \langle \psi ^+|+(1-p)\frac{\mathrm {I}}{d}\). For randomly generated 3-dimensional density matrices, we have drawn a boundary diagram with a apparently clear boundary line. In entanglement measures, we used PPT states to replace the set of separable states and calculated two-qubit states, the isotropic states and the Werner states by using fidelity and its semidefinite program, and then concluded that their maximum deviation is almost on the order of magnitude of \(10^{-9}\).