numpoly.remove_redundant_coefficients#
- numpoly.remove_redundant_coefficients(exponents: ArrayLike, coefficients: Sequence[ArrayLike]) Tuple[ndarray, List[ndarray]][source]#
Remove coefficients if they are redundant to the polynomial representation.
Will always keep at least one coefficient.
- 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.- coefficients:
The polynomial coefficients. Must correspond to exponents by having the same length
N.
- Return:
Same as inputs, but with redundant exponent rows and coefficients removed. This corresponds to
Nbeing lowered.- Example:
>>> exponents, coefficients = remove_redundant_coefficients( ... [[0, 0], [0, 1]], [1, 2]) >>> exponents array([[0, 0], [0, 1]]) >>> coefficients [array(1), array(2)] >>> remove_redundant_coefficients( ... [[0, 0], [0, 1]], [1, 0]) (array([[0, 0]]), [array(1)]) >>> remove_redundant_coefficients([[0]], [[]]) (array([[0]]), [array([], dtype=float64)])