OperatorTrait
class OperatorTrait(*args, **kwargs)
Bases: Protocol
A protocol indicating all methods implemented by operator classes.
Attributes
groups
Returns the groups indices.
Methods
adjoint
equiv
equiv(other, atol)
Checks this operator with another for equivalence up to the specified absolute tolerance.
Parameters
Return type
from_terms
classmethod from_terms(terms)
Constructs a new operator from an iterator (see also iter_terms()).
Parameters
terms (Iterable)
Return type
from_terms_with_groups
classmethod from_terms_with_groups(terms)
Constructs a new operator from an iterator (see also iter_terms_with_groups()).
Parameters
terms (Iterable)
Return type
get_coeffs
get_support
get_support()
Returns the set of mode indices which this operator acts upon.
Return type
group_weights
group_weights()
Returns the mean absolute coefficient magnitude of each group.
This is equivalent to (but cheaper than) reducing get_coeffs() and groups down to one value per group in NumPy, because it does not copy one value per ungrouped term out of the operator just to aggregate it away again.
Return type
has_groups
has_groups()
Returns whether this operator tracks group indices.
This is equivalent to (but cheaper than) checking op.groups is not None, because it does not copy the group indices out of the operator in order to inspect them.
Return type
ichop
ichop(atol)
Trims coefficients below the absolute tolerance from this operator.
Parameters
atol (float)
iter_terms
iter_terms_with_groups
iter_terms_with_groups()
Iterates over the terms of this operator with their group indices.
Return type
normal_ordered
normal_ordered(*args, **kwargs)
Returns the normal-ordered form of this operator.
A specific implementation of this method may take additional arguments.
Return type
num_groups
one
relabel_modes
relabel_modes(permutation)
Relabels the modes of the operator.
Parameters
Return type
simplify
simplify(atol)
Simplifies the terms of this operator, discarding those below the absolute tolerance.
Parameters
atol (float)
Return type
split_out_groups
split_out_groups(group_indices=None)
Splits this operator into an optional list of new operators based on its groups.
If group_indices is omitted, every group is built, in index order. Otherwise, only the requested indices are built, in the given order.
Parameters
group_indices (Sequence[int] | None)
Return type