pygsti.baseobjs.protectedarray
Defines the ProtectedArray class
Module Contents
Classes
A numpy ndarray-like class that allows certain elements to be treated as read-only. |
- class pygsti.baseobjs.protectedarray.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_arraynumpy.ndarray
The base array.
- indices_to_protectint 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_masknumpy.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.
- base