Last updated on Sep 04, 2024.

netsse.tools.misc_func.pad#

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

Adds zeros to an array along one of its dimensions.

Parameters:
  • U (array_like of shape (n,m) or (n,)) – Input array to be padded with zeros at the beginning.

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

  • add (float or array_like, default 0) – Term that is added to the concatenated zeros.

Returns:

U_pad – Extended array, where U has been padded with a first column (respectively, row) of zeros (plus an optional added term).

Note

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

  • If U is a 1d-array, then the output array U_pad has a new shape of (n+1,). A zero element has been added at the beginning.

Return type:

array_like

See also

wrap

Wraps an array around one of its dimensions.

Example

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