Skip to main content

The diamond norm between two completely positive trace-preserving (CPTP) superoperators

Project description

QuantumFlow Diamond Norm

Gavin E. Crooks (2020)

Build Status Documentation Status


Calculation of the diamond norm between two completely positive trace-preserving (CPTP) superoperators, using the QuantumFlow package

The calculation uses the simplified semidefinite program of Watrous arXiv:0901.4709 [J. Watrous, Theory of Computing 5, 11, pp. 217-238 (2009)]

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
$ 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)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qf_diamond_norm-1.1.1.tar.gz (14.7 kB view hashes)

Uploaded source

Built Distribution

qf_diamond_norm-1.1.1-py3-none-any.whl (6.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page