numpoly.array_split#
- numpoly.array_split(ary: numpoly.typing.PolyLike, indices_or_sections: ArrayLike, axis: int = 0) List[ndpoly][source]#
Split an array into multiple sub-arrays.
Please refer to the
splitdocumentation. The only difference between these functions is thatarray_splitallows 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]])