numpoly.remove_redundant_names¶
- numpoly.remove_redundant_names(exponents: Union[int, float, complex, str, bytes, numpy.generic, Sequence[Union[int, float, complex, str, bytes, numpy.generic]], Sequence[Sequence[Any]], numpy.typing._array_like._SupportsArray], 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), whereNis the number of terms in the polynomial sum andDis 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.
- Returns:
Same as inputs, but with redundant exponent columns and names removed. This corresponds to
Dbeing lowered.- Examples:
>>> 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',)