Git Product home page Git Product logo

Comments (2)

enielse avatar enielse commented on August 14, 2024

Good question - there are a couple things you need to do differently to compute the diamond norm you're after:

  1. pyGSTi's diamonddist function operates on the "superoperator" or "Pauli Transfer Matrix" form of the gate, not the Choi form (in which a Pauli channel is diagonal) - so you need to convert your diagonal Choi matrices to the superoperator form using jamiolkowski_iso.
  2. pyGSTi's Pauli basis matrices are normalized to 1.0 rather than d (the dimension of the Hilbert space, so 2 for a single qubit) as they are in https://arxiv.org/abs/1109.6887, so you need to convert between normalizations by multiplying by a factor of 22 = 4. The exponent of 2 comes from the fact that each element of pr1 or pr2 is the coefficient of a term like Pi rho Pi in which there are 2 Paulis.

So the following will give you what you're after:

import numpy as np
pr1 = np.array([0.2,0.3,0.2,0.3]) # understood to be in basis of norm=2 Paulis
pr2 = np.array([0.5,0.4,0.05,0.05])

import pygsti
g1 = pygsti.tools.jamiolkowski_iso(4*np.diag(pr1), 'pp','pp')
g2 = pygsti.tools.jamiolkowski_iso(4*np.diag(pr2), 'pp','pp')
pygsti.gatetools.diamonddist(g1,g2,mxBasis='pp')

This gives the 0.8 you expect.

from pygsti.

dcmckayibm avatar dcmckayibm commented on August 14, 2024

Thanks, figured it was some different normalization issue.

from pygsti.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.