pygsti.objects.GateSet.bulk_hproduct¶
-
GateSet.
bulk_hproduct
(evalTree, flat=False, bReturnDProdsAndProds=False, bScale=False, comm=None)¶ Return the Hessian of many gate string products at once.
Parameters: - evalTree (EvalTree) – given by a prior call to bulk_evaltree. Specifies the gate strings to compute the bulk operation on.
- flat (bool, optional) – Affects the shape of the returned derivative array (see below).
- bReturnDProdsAndProds (bool, optional) – when set to True, additionally return the probabilities and their derivatives.
- bScale (bool, optional) – When True, return a scaling factor (see below).
- comm (mpi4py.MPI.Comm, optional) – When not None, an MPI communicator for distributing the computation across multiple processors. Distribution is first done over the set of parameters being differentiated with respect to when the second derivative is taken. If there are more processors than gateset parameters, distribution over a split evalTree (if given) is possible.
Returns: hessians (numpy array) – * if flat == False, an array of shape S x M x M x G x G, where
- S == len(gatestring_list)
- M == the length of the vectorized gateset
- G == the linear dimension of a gate matrix (G x G gate matrices)
and hessians[i,j,k,l,m] holds the derivative of the (l,m)-th entry of the i-th gate string product with respect to the k-th then j-th gateset parameters.
if flat == True, an array of shape S*N x M x M where
- N == the number of entries in a single flattened gate (ordering as numpy.flatten),
- S,M == as above,
and hessians[i,j,k] holds the derivative of the (i % G^2)-th entry of the (i / G^2)-th flattened gate string product with respect to the k-th then j-th gateset parameters.
derivs (numpy array) – Only returned if bReturnDProdsAndProds == True.
if flat == False, an array of shape S x M x G x G, where
- S == len(gatestring_list)
- M == the length of the vectorized gateset
- G == the linear dimension of a gate matrix (G x G gate matrices)
and derivs[i,j,k,l] holds the derivative of the (k,l)-th entry of the i-th gate string product with respect to the j-th gateset parameter.
if flat == True, an array of shape S*N x M where
- N == the number of entries in a single flattened gate (ordering is
the same as that used by numpy.flatten),
S,M == as above,
and deriv[i,j] holds the derivative of the (i % G^2)-th entry of the (i / G^2)-th flattened gate string product with respect to the j-th gateset parameter.
products (numpy array) – Only returned when bReturnDProdsAndProds == True. An array of shape S x G x G; products[i] is the i-th gate string product.
scaleVals (numpy array) – Only returned when bScale == True. An array of shape S such that scaleVals[i] contains the multiplicative scaling needed for the hessians, derivatives, and/or products for the i-th gate string.