numpoly.stack#
- numpoly.stack(arrays: Sequence[numpoly.typing.PolyLike], axis: int = 0, out: ndpoly | None = None) ndpoly[source]#
Join a sequence of arrays along a new axis.
The
axisparameter specifies the index of the new axis in the dimensions of the result. For example, ifaxis=0it will be the first dimension and ifaxis=-1it 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]])