pygsti.algorithms.germselection.compute_composite_germ_set_score_compactevd

pygsti.algorithms.germselection.compute_composite_germ_set_score_compactevd#

compute_composite_germ_set_score_compactevd(current_update_cache, germ_update, score_fn='all', threshold_ac=1000000.0, init_n=1, model=None, partial_germs_list=None, eps=None, num_germs=None, op_penalty=0.0, l1_penalty=0.0, num_nongauge_params=None, num_params=None, force_rank_increase=False, germ_lengths=None, gate_penalty=None, germ_list=None)#

Compute the score for a germ set when it is not AC against a model.

Normally scores computed for germ sets against models for which they are not AC will simply be astronomically large. This is fine if AC is all you care about, but not so useful if you want to compare partial germ sets against one another to see which is closer to being AC. This function will see if the germ set is AC for the parameters corresponding to the largest N eigenvalues for increasing N until it finds a value of N for which the germ set is not AC or all the non gauge parameters are accounted for and report the value of N as well as the score. This allows partial germ set scores to be compared against one-another sensibly, where a larger value of N always beats a smaller value of N, and ties in the value of N are broken by the score for that value of N.

Parameters:
  • current_update_cache (tuple) – A tuple whose elements are the components of the current update cache for performing a low-rank update. Elements are (e, U , projU).

  • germ_update (ndarray) – A numpy array corresponding to one half of the low-rank symmetric update to to perform.

  • score_fn (callable) – A function that takes as input a list of sorted eigenvalues and returns a score for the partial germ set based on those eigenvalues, with lower scores indicating better germ sets. Usually some flavor of list_score().

  • threshold_ac (float, optional) – Value which the score (before penalties are applied) must be lower than for the germ set to be considered AC.

  • init_n (int) – The number of largest eigenvalues to begin with checking.

  • model (Model, optional) – The model against which the germ set is to be scored. Not needed if partial_deriv_dagger_deriv is provided.

  • partial_germs_list (list of Circuit, optional) – The list of germs in the partial germ set to be evaluated. Not needed if partial_deriv_dagger_deriv (and germ_lengths when op_penalty > 0) are provided.

  • eps (float, optional) – Used when calculating partial_deriv_dagger_deriv to determine if two eigenvalues are equal (see _bulk_twirled_deriv() for details). Not used if partial_deriv_dagger_deriv is provided.

  • op_penalty (float, optional) – Coefficient for a penalty linear in the sum of the germ lengths.

  • germ_lengths (numpy.array, optional) – The length of each germ. Not needed if op_penalty is 0.0 or partial_germs_list is provided.

  • l1_penalty (float, optional) – Coefficient for a penalty linear in the number of germs.

  • num_nongauge_params (int, optional) – Force the number of nongauge parameters rather than rely on automated gauge optimization.

  • num_params (int) – Total number of model parameters.

  • force_rank_increase (bool, optional) – Whether to force the greedy iteration to select a new germ that increases the rank of the jacobian at each iteration (this may result in choosing a germ that is sub-optimal with respect to the chosen score function). Also results in pruning in subsequent optimization iterations. Defaults to False.

  • gate_penalty (dict, optional (default None)) – An optional dictionary allowing the specification of gate-specific penalties to add for each instance of the specified gate(s) in each germ. Should be specified as a dictionary whose keys are strings corresponding to gate names, and whose values are the penalty factor to add for each instance of that gate. E.g. {‘Gcnot’:2} would correspond to a penalty term where each instance of a ‘Gcnot’ gate gets and additional 2 units added to the cost function for a candidate germ.

  • germ_list (list of `Circuit`s, optional (default None)) – A list of circuits corresponding to the current candidate set of germs (including the candidate addition being evaluated). Must be specified when using the gate_penalty kwarg.

  • num_germs (Optional[int])

Returns:

The score for the germ set indicating how many parameters it amplifies and its numerical score restricted to those parameters.

Return type:

CompositeScore