sandialabs / pyGSTi

A python implementation of Gate Set Tomography
http://www.pygsti.info
Apache License 2.0
134 stars 56 forks source link

Affine term disappers when applying cloud crosstalk model #483

Open KangHaiYue opened 1 week ago

KangHaiYue commented 1 week ago

Describe the bug When creating a crosstalk model by calling pygsti.models.create_cloud_crosstalk_model by passing an error dictionary into lindblad_error_coeffs which contains non-zero affine terms, e.g. error_dict = {('Gi', 1): {'SZ:1': 0.1, 'SZ:2': 0.1, 'SZZ:1,2': 0.1, 'AZ:1': 0.1, 'AZ:2': 0.1, 'AZZ:1,2': 0.01, 'HZZ:1,2': 0}}, it disappers when calling operation_blks["cloudnoise"][("Gi", 1)]

To Reproduce `import pygsti import numpy as np labels = [1,2] pspec = pygsti.processors.QubitProcessorSpec( num_qubits=len(labels), qubit_labels=labels, gate_names=[ "Gxpi", "Gypi", "Gzpi", "Gx", "Gy", "Gz", "Gh", "Gp", "Gt", "Gzr", "Gcnot", "Gcphase", "Gswap", "Gi" ], availability={ "Gcnot": "all-permutations", "Gcphase": "all-permutations", "Gswap": "all-permutations", }, )

error_dict = {('Gi', 1): {'SZ:1': 0.1, 'SZ:2': 0.1, 'SZZ:1,2': 0.1, 'AZ:1': 0.1, 'AZ:2': 0.1, 'AZZ:1,2': 0.01, 'HZZ:1,2': 0}} mdl = pygsti.models.create_cloud_crosstalk_model(pspec, lindblad_error_coeffs=error_dict)

mdl.operation_blks["cloudnoise"][("Gi", 1)].errorgen_coefficients()`

The printed dictionary doesn't contain the affine term. I also tried to apply mdl.operation_blks["cloudnoise"][("Gi", 1)].acton(rho) to a rho that is a density operator in Pauli product basis with just Affine term (setting all other parameters to 0 except the affine term), but nothing is changed. This indeed means the affine term is not added into the model.

Environment

sserita commented 1 week ago

Hi @KangHaiYue, thanks for the bug report! We will look into this and get back to you shortly.

Just for complete clarity, I'll mention when Lindblad generators in pyGSTi were parameterized with just H/S/A, the A generators were indeed called affine. However, a while ago we swapped to using the H/S/C/A generators from the taxonomy of small error generators paper. These A generators are different than the old affine generators, and are more commonly called active or antisymmetric nowadays. Terminology differences aside, these are different from the old affine generators, so if you do indeed mean affine and are expecting them to have the old behavior, then this code will likely not give you what you want - you'll have to figure out what your map is with the new error generator definitions.

KangHaiYue commented 1 week ago

Hi @sserita , thank you for your reply, especially for providing the paper that gives a lot of insight. From that paper, it seems that the asymmetric noise in the Z-direction is controlled by the coefficient of the A_{X,Y} generator (Section V.F. or Fig 7). So how should I implement this in the error_dict ? E.g. something like error_dict = {('Gi', 1): {'AX:1': 0.1, 'AY:1': 0.1}}? I tried to replace this with the codes above, however, the coefficients for A are still 0 (although this time they do at least show up after calling mdl.operation_blks["cloudnoise"][("Gi", 1)].errorgen_coefficients() instead of nothing . Also, how should the parameters look like in the case of many qubits?