numpoly.remove_redundant_names#

numpoly.remove_redundant_names(exponents: ArrayLike, names: Sequence[str] | None) Tuple[ndarray, Tuple[str, ...] | None][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), where N is the number of terms in the polynomial sum and D 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',)