# RelEntCoherence

 Other toolboxes required RelEntCoherence Computes the relative entropy of coherence of a quantum state none L1NormCoherenceRobustnessCoherenceTraceDistanceCoherence Coherence and incoherence no

RelEntCoherence is a function that computes the relative entropy of coherence of a quantum state $\rho$, defined as follows:

$C_{r}(\rho) := -\mathrm{Tr}\big(\rho(\log_2(\rho) - \log_2(\rho_{\text{diag}}))\big),$

where $\rho_{\text{diag}}$ is the matrix that has the same diagonal as $\rho$ but is zero elsewhere.

## Syntax

• REC = RelEntCoherence(RHO)

## Argument descriptions

• RHO: A state (either pure or mixed) to have its relative entropy of coherence computed.

## Examples

### Maximally coherent states

The largest possible value of the relative entropy of coherence on $d$-dimensional states is $\log_2(d)$, and is attained exactly by the "maximally coherent states": pure states whose entries all have the same absolute value.

>> d = 5;
>> v = ones(d,1)/sqrt(d); % this is a maximally coherent state
>> RelEntCoherence(v)

ans =

2.3219

>> log(5)/log(2)

ans =

2.3219

## Source code

Click on "expand" to the right to view the MATLAB source code for this function.

1. %%  RelEntCoherence    Computes the relative entropy of coherence of a quantum state
2. %   This function has one required argument:
3. %     RHO: a density matrix or pure state vector
4. %
5. %   REC = RelEntCoherence(RHO) is the relative entropy of coherence, which
6. %   equals S(diag(RHO)) - S(RHO), where S(.) is the von Neumann entropy.
7. %
8. %   URL: http://www.qetlab.com/RelEntCoherence
9. 
10. %   requires: Entropy.m, pure_to_mixed.m
11. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
12. %   package: QETLAB
13. %   last updated: January 12, 2016
14. 
15. function REC = RelEntCoherence(rho)
16. 
17. rho = pure_to_mixed(rho); % Let the user specify rho as either a density matrix or a pure state vector
18. 
19. REC = Entropy(diag(diag(rho))) - Entropy(rho);