numpoly.remove_redundant_names¶
- numpoly.remove_redundant_names(exponents: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], names: Optional[Sequence[str]]) → Tuple[numpy.ndarray, Optional[Tuple[str, ...]]][source]¶
Remove names if they are redundant to the polynomial representation.
Will always keep at least one dimension.
- Args:
- exponents:
The exponents in an integer array with shape
(N, D)
, whereN
is the number of terms in the polynomial sum andD
is the number of dimensions.- names:
The indeterminant names, either as string names or as simple polynomials. Must correspond to the exponents by having length
D
.
- Return:
Same as inputs, but with redundant exponent columns and names removed. This corresponds to
D
being lowered.- Example:
>>> exponents, names = remove_redundant_names( ... [[0, 0], [1, 1]], ["q0", "q1"]) >>> exponents array([[0, 0], [1, 1]]) >>> names ('q0', 'q1') >>> exponents, names = remove_redundant_names( ... [[0, 0], [0, 1]], ["q0", "q1"]) >>> exponents array([[0], [1]]) >>> names ('q1',) >>> exponents, names = remove_redundant_names( ... [[0, 0]], ["q0", "q1"]) >>> exponents array([[0]]) >>> names ('q0',)