Gavin E. Crooks (2020)
Calculation of the diamond norm between two completely positive trace-preserving (CPTP) superoperators, using the QuantumFlow package
Kudos: Based on MatLab code written by Marcus P. da Silva
Note: Diamond norm requires that the “cvxpy” package (and dependencies) be fully installed. Installing cvxpy via pip does not correctly install all the necessary packages.
$ conda install -c conda-forge cvxpy $ git clone https://github.com/gecrooks/qf_diamond_norm.git $ cd qf_diamond_norm $ pip install -e .
> import quantumflow as qf > from qf_diamond_norm import diamond_norm > chan0 = qf.random_channel([0, 1, 2]) # 3-qubit channel > chan1 = qf.random_channel([0, 1, 2]) > dn = diamond_norm(chan0, chan1) > print(dn)