Last updated on Sep 04, 2024.

netsse.tools.misc_func.wrap#

netsse.tools.misc_func.wrap(U, axis=1, add=0)#

Wraps an array around one of its dimensions.

Parameters:
  • U (array_like of shape (n,m) or (n,)) – Input array to be wrapped around.

  • axis ({1,0}, optional) – If U is a 2d-array, the axis of U along which to wrap. The default is 1.

  • add (float or array_like, default 0) – Term that is added to the repeated part of U before concatenation.

Returns:

U_wrap – Extended array, where the first column (respectively, row) of U has been repeated by concatenation at the end of U.

Note

  • If U is a 2d-array, then the output array has a shape of (n+1*(axis==0),m+1*(axis==1)).

  • If U is a 1d-array, then the output array has a shape of (n+1,). The first element of U has been repeated at the end.

Return type:

array_like

See also

pad

Adds zeros to an array along one of its dimensions.

Example

>>> U_wrap = wrap(U,axis=1,add=0)