Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions pygsti/modelmembers/operations/embeddederrorgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,26 @@ def coefficients(self, return_basis=False, logscale_nonham=False, label_type='gl
Where `termType` is `"H"` (Hamiltonian), `"S"` (Stochastic),
`"C"`(Correlation) or `"A"` (Affine). Hamiltonian and S terms always have a
single basis label while 'C' and 'A' terms have two.
"""
coeffs_to_embed = self.embedded_op.coefficients(return_basis, logscale_nonham, label_type)

basis : `Basis` (if return_basis==True)
A Basis mapping the basis labels used in the keys of basis-labels of the
underlying (pre-embedding) error generator coeffs to basis matrices.
"""
if return_basis:
coeffs_to_embed, basis = self.embedded_op.coefficients(return_basis, logscale_nonham, label_type)
else:
coeffs_to_embed = self.embedded_op.coefficients(return_basis, logscale_nonham, label_type)

if coeffs_to_embed:
embedded_labels = self.coefficient_labels(label_type=label_type, identity_label=identity_label)
embedded_coeffs = {lbl:val for lbl, val in zip(embedded_labels, coeffs_to_embed.values())}
else:
embedded_coeffs = dict()

return embedded_coeffs
if return_basis:
return embedded_coeffs, basis
else:
return embedded_coeffs

def coefficient_labels(self, label_type='global', identity_label='I'):
"""
Expand Down
16 changes: 13 additions & 3 deletions pygsti/modelmembers/operations/embeddedop.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,17 +600,27 @@ def errorgen_coefficients(self, return_basis=False, logscale_nonham=False, label
Where `termType` is `"H"` (Hamiltonian), `"S"` (Stochastic),
`"C"`(Correlation) or `"A"` (Affine). Hamiltonian and S terms always have a
single basis label while 'C' and 'A' terms have two.

basis : `Basis` (if return_basis==True)
A Basis mapping the basis labels used in the keys of basis-labels of the
underlying (pre-embedding) error generator coeffs to basis matrices.
"""
#*** Note: this function is nearly identical to EmbeddedErrorgen.coefficients() ***
coeffs_to_embed = self.embedded_op.errorgen_coefficients(return_basis, logscale_nonham, label_type)

if return_basis:
coeffs_to_embed, basis = self.embedded_op.errorgen_coefficients(return_basis, logscale_nonham, label_type)
else:
coeffs_to_embed, basis = self.embedded_op.errorgen_coefficients(return_basis, logscale_nonham, label_type)

if coeffs_to_embed:
embedded_labels = self.errorgen_coefficient_labels(label_type=label_type, identity_label=identity_label)
embedded_coeffs = {lbl:val for lbl, val in zip(embedded_labels, coeffs_to_embed.values())}
else:
embedded_coeffs = dict()

return embedded_coeffs
if return_basis:
return embedded_coeffs, basis
else:
return embedded_coeffs

def errorgen_coefficient_labels(self, label_type='global', identity_label='I'):
"""
Expand Down
Loading