pygsti.objects.GateSet.bulk_hprobs_by_column

GateSet.bulk_hprobs_by_column(spam_label_rows, evalTree, bReturnDProbs12=False, clipTo=None, check=False, comm=None, wrtFilter=None)

Constructs a generator that computes the 2nd derivatives of the probabilities generated by a each gate sequence given by evalTree column-by-column.

This routine can be useful when memory constraints make constructing the entire Hessian at once impractical, and one is able to compute reduce results from a single column of the Hessian at a time. For example, the Hessian of a function of many gate sequence probabilities can often be computed column-by-column from the using the columns of the gate sequences.

Parameters:
  • spam_label_rows (dictionary) – a dictionary with keys == spam labels and values which are integer row indices into mxToFill, specifying the correspondence between rows of mxToFill and spam labels.
  • evalTree (EvalTree) – given by a prior call to bulk_evaltree. Specifies the gate strings to compute the bulk operation on. This tree cannot be split.
  • bReturnDProbs12 (boolean, optional) – If true, the generator computes a 2-tuple: (hessian_col, d12_col), where d12_col is a column of the matrix d12 defined by: d12[iSpamLabel,iGateStr,p1,p2] = dP/d(p1)*dP/d(p2) where P is is the probability generated by the sequence and spam label indexed by iGateStr and iSpamLabel. d12 has the same dimensions as the Hessian, and turns out to be useful when computing the Hessian of functions of the probabilities.
  • comm (mpi4py.MPI.Comm, optional) – When not None, an MPI communicator for distributing the computation across multiple processors. Distribution is performed as in bulk_product, bulk_dproduct, and bulk_hproduct.
  • wrtFilter (list of ints, optional) – If not None, a list of integers specifying the indices of the parameters to include in the 2nd derivative dimension, i.e., which Hessian columns to compute.
Returns:

A generator which, when iterated, yields an array of shape K x S x M x 1 numpy array (a Hessian column), where K is the length of spam_label_rows, S is equal to the number of gate strings (i.e. evalTree.num_final_strings()), and M is the number of gateset parameters. If bReturnDProbs12 == True, then two such arrays are given (as a 2-tuple).

Return type:

column_generator