pygsti.algorithms.gaugeopt.GaugeoptToTargetArgs#

class GaugeoptToTargetArgs#

Bases: object

This class is basically a namespace. It was introduced to strip out tons of complexity in gaugeopt_to_target(…) without breaking old code that might call gaugeopt_to_target.

Methods

__init__()

create_full_kwargs(args, kwargs)

parsed_method(target_model, method, ...)

parsed_model(model, convert_model_to)

Attributes

create_objective_passthrough_kwargs

dict

gaugeopt_custom_passthrough_kwargs

int

old_trailing_positional_args

other_kwargs

{"frobenius", "fidelity", "tracedist"}, optional

create_objective_passthrough_kwargs: dict[str, Any] = {'check_jac': False, 'cptp_penalty_factor': 0, 'item_weights': None, 'spam_penalty_factor': 0}#
dict

Dictionary of weighting factors for gates and spam operators. Keys can be gate, state preparation, or POVM effect, as well as the special values “spam” or “gates” which apply the given weighting to all spam operators or gates respectively. Values are floating point numbers. Values given for specific gates or spam operators take precedence over “gates” and “spam” values. The precise use of these weights depends on the model metric(s) being used.

cptp_penalty_factorfloat

If greater than zero, the objective function also contains CPTP penalty terms which penalize non-CPTP-ness of the gates being optimized. This factor multiplies these CPTP penalty terms.

spam_penalty_factorfloat

If greater than zero, the objective function also contains SPAM penalty terms which penalize non-positive-ness of the state preps being optimized. This factor multiplies these SPAM penalty terms.

check_jacbool

When True, check least squares analytic jacobian against finite differences.

Type:

item_weights

gaugeopt_custom_passthrough_kwargs: dict[str, Any] = {'maxfev': None, 'maxiter': 100000, 'oob_check_interval': 0, 'tol': 1e-08, 'verbosity': 0}#
int

Maximum number of iterations for the gauge optimization.

maxfevint

Maximum number of function evaluations for the gauge optimization. Defaults to maxiter.

tolfloat

The tolerance for the gauge optimization.

oob_check_intervalint

If greater than zero, gauge transformations are allowed to fail (by raising any exception) to indicate an out-of-bounds condition that the gauge optimizer will avoid. If zero, then any gauge-transform failures just terminate the optimization.

Type:

maxiter

other_kwargs: dict[str, Any] = {'comm': None, 'convert_model_to': None, 'gates_metric': 'frobenius', 'gauge_group': None, 'method': 'auto', 'return_all': False, 'spam_metric': 'frobenius'}#
{“frobenius”, “fidelity”, “tracedist”}, optional

The metric used to compare gates within models. “frobenius” computes the normalized sqrt(sum-of-squared-differences), with weights multiplying the squared differences (see Model.frobeniusdist()). “fidelity” and “tracedist” sum the individual infidelities or trace distances of each gate, weighted by the weights.

spam_metric{“frobenius”, “fidelity”, “tracedist”}, optional

The metric used to compare spam vectors within models. “frobenius” computes the normalized sqrt(sum-of-squared-differences), with weights multiplying the squared differences (see Model.frobeniusdist()). “fidelity” and “tracedist” sum the individual infidelities or trace distances of each “SPAM gate”, weighted by the weights.

gauge_groupGaugeGroup, optional

The gauge group which defines which gauge transformations are optimized over. If None, then the model’s default gauge group is used.

methodstring, optional

The method used to optimize the objective function. Can be any method known by scipy.optimize.minimize such as ‘BFGS’, ‘Nelder-Mead’, ‘CG’, ‘L-BFGS-B’, or additionally:

  • ‘auto’ – ‘ls’ when allowed, otherwise ‘L-BFGS-B’

  • ‘ls’ – custom least-squares optimizer.

  • ‘custom’ – custom CG that often works better than ‘CG’

  • ‘supersimplex’ – repeated application of ‘Nelder-Mead’ to converge it

  • ‘basinhopping’ – scipy.optimize.basinhopping using L-BFGS-B as a local optimizer

  • ‘swarm’ – particle swarm global optimization algorithm

  • ‘evolve’ – evolutionary global optimization algorithm using DEAP

  • ‘brute’ – Experimental: scipy.optimize.brute using 4 points along each dimensions

convert_model_tostr, dict, list, optional

For use when model is an ExplicitOpModel. When not None, calls model.convert_members_inplace(convert_model_to, set_default_gauge_group=False) if convert_model_to is a string, model.convert_members_inplace(**convert_model_to) if it is a dict, and repeated calls to either of the above instances when convert_model_to is a list or tuple prior to performing the gauge optimization. This allows the gauge optimization to be performed using a differently constrained model.

return_allbool, optional

When True, return best “goodness” value and gauge matrix in addition to the gauge optimized model.

commmpi4py.MPI.Comm, optional

When not None, an MPI communicator for distributing the computation across multiple processors.

Type:

gates_metric