pygsti.baseobjs.protectedarray.ProtectedArray

Contents

pygsti.baseobjs.protectedarray.ProtectedArray#

class ProtectedArray(input_array, indices_to_protect=None, protected_index_mask=None)#

Bases: object

A numpy ndarray-like class that allows certain elements to be treated as read-only.

Parameters:
  • input_array (numpy.ndarray) – The base array.

  • indices_to_protect (int or list of tuples, optional) – A list of length input_array.shape, specifying the indices to protect along each axis. Values may be integers, slices, or lists of integers, e.g. (0, slice(None, None, None)). Also supported are iterables over tuples/lists, each of length input_array.shape, specifying the indices to protect along each axis.

  • protected_index_mask (numpy.ndarray, optional) – An optional array with the same shape as input_array which if specified is used to initialize the mask for protected indices used by this array. Note that is specified the value overrides any specification given in indices_to_protect, meaning that argument is ignored.

Methods

__init__(input_array[, indices_to_protect, ...])