:py:mod:`pygsti.modelmembers.operations.fulltpop` ================================================= .. py:module:: pygsti.modelmembers.operations.fulltpop .. autoapi-nested-parse:: The FullTPOp class and supporting functionality. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: pygsti.modelmembers.operations.fulltpop.FullTPOp .. py:class:: FullTPOp(m, basis=None, evotype='default', state_space=None) Bases: :py:obj:`pygsti.modelmembers.operations.denseop.DenseOperator`, :py:obj:`pygsti.modelmembers.torchable.Torchable` A trace-preserving operation matrix. An operation matrix that is fully parameterized except for the first row, which is frozen to be [1 0 ... 0] so that the action of the operation, when interpreted in the Pauli or Gell-Mann basis, is trace preserving (TP). Bases other than Pauli or Gell-Mann are supported only if their first element is the identity matrix. Parameters ---------- m : array_like or LinearOperator a square 2D array-like or LinearOperator object representing the operation action. The shape of m sets the dimension of the operation. basis : Basis or {'pp','gm'} or None The basis used to construct the Hilbert-Schmidt space representation of this state as a super-operator. If None, certain functionality, such as access to Kraus operators, will be unavailable. evotype : Evotype or str, optional The evolution type. The special value `"default"` is equivalent to specifying the value of `pygsti.evotypes.Evotype.default_evotype`. state_space : StateSpace, optional The state space for this operation. If `None` a default state space with the appropriate number of qubits is used. Attributes ---------- base : numpy.ndarray Direct access to the underlying process matrix data. Initialize a new LinearOperator .. py:property:: num_params Get the number of independent parameters which specify this operation. Returns ------- int the number of independent parameters. .. py:method:: set_dense(m) Set the dense-matrix value of this operation. Attempts to modify operation parameters so that the specified raw operation matrix becomes mx. Will raise ValueError if this operation is not possible. Parameters ---------- m : array_like or LinearOperator An array of shape (dim, dim) or LinearOperator representing the operation action. Returns ------- None .. py:method:: to_vector() Get the operation parameters as an array of values. Returns ------- numpy array The operation parameters as a 1D array with length num_params(). .. py:method:: from_vector(v, close=False, dirty_value=True) Initialize the operation using a vector of parameters. Parameters ---------- v : numpy array The 1D vector of operation parameters. Length must == num_params() close : bool, optional Whether `v` is close to this operation's current set of parameters. Under some circumstances, when this is true this call can be completed more quickly. dirty_value : bool, optional The value to set this object's "dirty flag" to before exiting this call. This is passed as an argument so it can be updated *recursively*. Leave this set to `True` unless you know what you're doing. Returns ------- None .. py:method:: stateless_data() -> Tuple[int] Return this ModelMember's data that is considered constant for purposes of model fitting. Note: the word "stateless" here is used in the sense of object-oriented programming. .. py:method:: torch_base(sd: Tuple[int], t_param: torch.Tensor) -> torch.Tensor :staticmethod: Suppose "obj" is an instance of some Torchable subclass. If we compute vec = obj.to_vector() t_param = torch.from_numpy(vec) sd = obj.stateless_data() t = type(obj).torch_base(sd, t_param) then t will be a PyTorch Tensor that represents "obj" in a canonical numerical way. The meaning of "canonical" is implementation dependent. If type(obj) implements the ``.base`` attribute, then a reasonable implementation will probably satisfy np.allclose(obj.base, t.numpy()). .. py:method:: deriv_wrt_params(wrt_filter=None) The element-wise derivative this operation. Construct a matrix whose columns are the vectorized derivatives of the flattened operation matrix with respect to a single operation parameter. Thus, each column is of length op_dim^2 and there is one column per operation parameter. Parameters ---------- wrt_filter : list or numpy.ndarray List of parameter indices to take derivative with respect to. (None means to use all the this operation's parameters.) Returns ------- numpy array Array of derivatives with shape (dimension^2, num_params) .. py:method:: has_nonzero_hessian() Whether this operation has a non-zero Hessian with respect to its parameters. (i.e. whether it only depends linearly on its parameters or not) Returns ------- bool