numpoly.stack¶
- numpoly.stack(arrays: Sequence[numpoly.typing.PolyLike], axis: int = 0, out: Optional[numpoly.baseclass.ndpoly] = None) → numpoly.baseclass.ndpoly[source]¶
Join a sequence of arrays along a new axis.
The
axis
parameter specifies the index of the new axis in the dimensions of the result. For example, ifaxis=0
it will be the first dimension and ifaxis=-1
it will be the last dimension.- Args:
- arrays:
Each array must have the same shape.
- axis:
The axis in the result array along which the input arrays are stacked.
- out:
If provided, the destination to place the result. The shape must be correct, matching that of what stack would have returned if no out argument were specified.
- Return:
The stacked array has one more dimension than the input arrays.
- Example:
>>> poly = numpoly.variable(3) >>> const = numpoly.polynomial([1, 2, 3]) >>> numpoly.stack([poly, const]) polynomial([[q0, q1, q2], [1, 2, 3]]) >>> numpoly.stack([poly, const], axis=-1) polynomial([[q0, 1], [q1, 2], [q2, 3]])