numpoly.array_split¶
- numpoly.array_split(ary: numpoly.typing.PolyLike, indices_or_sections: 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]]], axis: int = 0) → List[numpoly.baseclass.ndpoly][source]¶
Split an array into multiple sub-arrays.
Please refer to the
split
documentation. The only difference between these functions is thatarray_split
allows indices_or_sections to be an integer that does not equally divide the axis. For an array of length l that should be split into n sections, it returns l % n sub-arrays of size l//n + 1 and the rest of size l//n.- Note:
split : Split an array into multiple sub-arrays of equal size.
- Example:
>>> poly = numpoly.monomial(8).reshape(2, 4) >>> poly polynomial([[1, q0, q0**2, q0**3], [q0**4, q0**5, q0**6, q0**7]]) >>> parts = numpoly.array_split(poly, 3, axis=1) >>> part1, part2, part3 = parts >>> part1 polynomial([[1, q0], [q0**4, q0**5]]) >>> part2 polynomial([[q0**2], [q0**6]]) >>> part3 polynomial([[q0**3], [q0**7]])